Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table Api Query on Int64 (long) column returning extra results #2385

Open
seankennett opened this issue Apr 3, 2024 · 1 comment
Open

Table Api Query on Int64 (long) column returning extra results #2385

seankennett opened this issue Apr 3, 2024 · 1 comment
Labels
table-storage Relating to Azurite table storage implementation

Comments

@seankennett
Copy link
Contributor

Which service(blob, file, queue, table) does this issue concern?

table

Which version of the Azurite was used?

3.29

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

npm and ran code from github main

What's the Node.js version?

9.8.1

What problem was encountered?

GET /devstoreaccount1/table()?$filter=PartitionKey%20ne%20%27Current%27%20and%20PlayIndex%20ge%2012L%20and%20PlayIndex%20lt%2013L HTTP/1.1

I do a query and find elements with playindex 12 (expected) but also 120-129 (wrong). This works perfectly fine against azure storage account so is specific to azurite. Also works fine if you drop the L from the query so it treats params as Int32.

Steps to reproduce the issue?

Add entities with a Int64 column and increment +1 each time to new column (add loads) then do a query for less than or equal to a small number and you'll get the extra results.

Have you found a mitigation/solution?

Workaround - dropping the L's off the query does the trick but fearful I may run into trouble on bigger numbers.

Solution attempt - I've had a dig around the code and it is because the filter value 13 is stored as a string as opposed to numeric so I ended up here:

QueryParser.ts

private visitNumber(): IQueryNode {
    const token = this.tokens.next(t => t.kind === "number") || this.throwUnexpectedToken("number");

    if (token.value!.endsWith("L")) {
      // This is a "long" number, which should be represented by its string equivalent
      return new ConstantNode(token.value!.substring(0, token.value!.length - 1));
    } else {
      return new ConstantNode(parseFloat(token.value!));
    }
  }

Adding a parseInt around the substring makes my case work correctly but the comment above suggests this is wrong, probably due to node numbers being smaller than int64. To try and fix I believe would entail a large code change that unfortunately I don't have the time for.

@EmmaZhu
Copy link
Collaborator

EmmaZhu commented Apr 9, 2024

Hi @seankennett ,

Thanks a lot for reporting this to us. I can repro the issue you met and I also think it may require large change to fix.

We'll evaluate the efforts but may not be able to prioritize the fix recently.

@edwin-huber edwin-huber added the table-storage Relating to Azurite table storage implementation label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
table-storage Relating to Azurite table storage implementation
Projects
None yet
Development

No branches or pull requests

3 participants