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

QueryEntitiesPagedResponse::MoveToNextPage() in Data Table SDK doesn't work #5617

Closed
krzwaraksa opened this issue May 13, 2024 · 2 comments · Fixed by #5625
Closed

QueryEntitiesPagedResponse::MoveToNextPage() in Data Table SDK doesn't work #5617

krzwaraksa opened this issue May 13, 2024 · 2 comments · Fixed by #5625
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Tables

Comments

@krzwaraksa
Copy link

krzwaraksa commented May 13, 2024

QueryEntitiesPagedResponse::MoveToNextPage() method in Azure Data Tables C++ SDK doesn't move to next page. The reason is probably a bug in QueryEntitiesPagedResponse::OnNextPage() method - NextPartitionKey is set to PartitionKey. In QueryEntities(). PartitionKey is set to PartitionKey in URL, but NextPartitionKey from response should be set to NextPartitionKey in the URL, as per documentation: https://learn.microsoft.com/en-us/rest/api/storageservices/query-timeout-and-pagination.

To Reproduce
Steps to reproduce the behavior:

  • run below code snippet

Code Snippet

#include <iostream>
#include <azure/data/tables.hpp>
#include <azure/identity/default_azure_credential.hpp>

int main() {
  const std::string tableName = "<your table name>";
  const std:: string storageUrl = "<your storage account URL>";

  auto cred = std::make_shared<Azure::Identity::DefaultAzureCredential>();
  auto tableClient = Azure::Data::Tables::TableClient(
      storageUrl , tableName, cred);

  for (int i = 0; i < 1010; i++)
  {
    auto entity = Azure::Data::Tables::Models::TableEntity();
    entity.SetPartitionKey("partition");
    entity.SetRowKey("rowKey" + std::to_string(i));
    tableClient.AddEntity(entity);
  }

  Azure::Data::Tables::Models::QueryEntitiesOptions options;
  auto response = tableClient.QueryEntities(options);
  std::cout << "number of entities: " << response.TableEntities.size(); // 1000, OK
  std::cout << "first entity row key: " << response.TableEntities[0].GetRowKey().Value; // rowKey0, OK
  std::cout << "last entity row key: " << response.TableEntities.back().GetRowKey().Value; // rowKey99, OK
  
  response.MoveToNextPage();
  std::cout << "number of entities: " << response.TableEntities.size(); // Wrong, got 1000, expected 10
  std::cout << "first entity row key: " << response.TableEntities[0].GetRowKey().Value; // Wrong, got 0, expected rowKey990
  std::cout << "last entity row key: " << response.TableEntities.back().GetRowKey().Value; // Wrong, got 99, expected rowKey999
}

Expected behavior
MoveToNextPage() should move pages, as shown in the code snippet.

Setup

  • OS: WSL, Ubuntu 22.04
  • IDE : VS Code
  • Version of the Library used: azure-data-tables-cpp, 1.0.0-beta.2 (pulled from VCPKG)
@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Tables labels May 13, 2024
Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@gearama
Copy link
Member

gearama commented May 14, 2024

Thank you for the report, looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Tables
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants