none
Tables: InvalidInput with 15-operator $filter

    Question

  • I wrote some code that attempts to load a number of entities in a single partition by their RowKeys. The Tables documentation says you can have "15 discrete comparisons" in a $filter, so I set it up that way - one comparison on PartitionKey and 14 comparison on RowKeys. The resulting filter string (extracted from Fiddler) looks like this:

    GET /devstoreaccount1/Statuses()?$filter=(PartitionKey%20eq%20'TEST_BOARD_ID')%20and%20((((((((((((((RowKey%20eq%20'44105329-e9df-4f8d-b5ed-5d15e92dabd5')%20or%20(RowKey%20eq%20'4f906de4-4353-4191-a34c-6a016ada0027'))%20or%20(RowKey%20eq%20'51b14e3a-0366-4c9a-9b5f-b0bcc7f330cc'))%20or%20(RowKey%20eq%20'708054b0-92f8-4a36-850f-95e658d11a71'))%20or%20(RowKey%20eq%20'8efa9213-e062-4c3e-9bd0-d73df1685aee'))%20or%20(RowKey%20eq%20'96defebd-933c-499a-8f98-67c2c0091720'))%20or%20(RowKey%20eq%20'a6dfa550-a6df-413a-af23-3dd4a03b6066'))%20or%20(RowKey%20eq%20'b66e4861-fd1d-4f93-b48e-87d7c5f785cb'))%20or%20(RowKey%20eq%20'd29f3880-78bc-4a6d-9135-1af297107513'))%20or%20(RowKey%20eq%20'e6d9930a-0197-4e02-9714-732a7830d285'))%20or%20(RowKey%20eq%20'ec79ece1-dd6f-4f37-add0-515aed3207bb'))%20or%20(RowKey%20eq%20'ee8b9774-338f-427f-a44f-c1be599e9a78'))%20or%20(RowKey%20eq%20'efce5af3-82b3-4031-be89-7784ee353495'))%20or%20(RowKey%20eq%20'f3062108-5a28-44ae-a021-638ae85fea07')) HTTP/1.1

    I count 15 "and"s and "or"s in there, but I got back an 400 error with and InvalidInput code from Table Storage.

    So I tried it with one less. 1 PartitionKey comparison and 13 RowKeys. That worked fine. So at least I have a workaround. But what's going on? Did I just miss counting some comparison?

    Friday, May 13, 2011 8:51 PM

Answers

  • Hi Brian,

    The limit is from WCF Data Service client library. This limit always existed. As suggested before it is more performant and best to use separate queries.

    Thanks,

    jai

    Saturday, February 25, 2012 6:45 AM

All replies

  • Hello Brian,

    Thank you posting!

    This is a quick note to let you know that I am performing research on this issue and will get back to you as soon as possible. I appreciate your patience. 

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Monday, May 16, 2011 9:46 AM
  • Hi Brian,

    I can reproduce the issue by the following code:

    var results = from word in _context.WordEntry
                    where word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854" ||
                    word.RowKey == "12520967486545235756_61382479-f86e-433b-b940-5197bcc84854"
                    select word;

    It throws an "InvalidInput" exception even though it has no more than 15 comparisons and works after removing 1 comparison. It seems that there is a document mistake or someting. I will forward this to the proper team and check if it really is a document issue or not.

    Thanks for your feedback,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Tuesday, May 17, 2011 9:04 AM
  • Hi Brian,

    Sorry for the late response.

    After discussing this with the proper team, there is still no solution for this however you may contact azure support (Click "Windows Azure" then select "Development Issues" and "Windows Azure Storage") and open an incident to work with support engineers to find answer.

    Thanks,


    Wengchao Zeng
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    Thursday, May 26, 2011 10:00 AM
  • Hi Brian,

     I am sorry for getting back late. Wengchao had pinged us about this. I see that this is against devstore. One reason I can think of may be change in the LINQ expression handled by the data service library (depending on the version of WCF Data Service - System.Data.Services). There was always a limit on the expression tree and depending on the form of the expression, you may get this.

     We will have a look at this in detail and get back early next week. Unfortunately, the workaround would be to issue multiple calls (one for each ||) or one range call if the selectivity is reasonable.

    -Jai


    Friday, May 27, 2011 2:13 PM
  • Hi Brian,

    The limit is from WCF Data Service client library. This limit always existed. As suggested before it is more performant and best to use separate queries.

    Thanks,

    jai

    Saturday, February 25, 2012 6:45 AM