Azure / azure-kusto-java

Microsoft Azure Kusto Library for Java
MIT License
38 stars 43 forks source link

Issue with Handling dynamic Column Type Returning No Rows for Kusto Function Call #387

Closed shridharpatil1 closed 1 month ago

shridharpatil1 commented 2 months ago

Describe the bug When invoking a Kusto function from a Spring Boot application using the com.microsoft.azure.kusto:kusto-data SDK, the function returns a response with a complex JSON object that includes only one column of type dynamic. Despite the function successfully executing in the Kusto query window, the SDK returns no rows in the result set.

The response structure includes a column named "data" with the ColumnType set to dynamic, but the Rows field is empty ("Rows":[]). The expected behavior is that the SDK should handle the dynamic column type and provide the JSON data in the result, even when there are no rows explicitly returned.

This issue may be specific to how the SDK processes dynamic types or handles function results that return complex JSON objects with nested fields.

To Reproduce

  1. Create a Kusto function that returns a complex JSON object with nested fields.
  2. Execute the function using the Kusto SDK in a Spring Boot application.
  3. Observe that while the function is executed successfully, the result set returns an empty Rows array and does not parse the dynamic data correctly.

Expected behavior The result set should contains row/rows

Screenshots

image

Setup (please complete the following information):

Desktop (please complete the following information):

Additional context response data : "[{\"FrameType\":\"DataSetHeader\",\"IsProgressive\":false,\"Version\":\"v2.0\",\"IsFragmented\":false,\"ErrorReportingPlacement\":\"InData\"},{\"FrameType\":\"DataTable\",\"TableId\":0,\"TableKind\":\"QueryProperties\",\"TableName\":\"@ExtendedProperties\",\"Columns\":[{\"ColumnName\":\"TableId\",\"ColumnType\":\"int\"},{\"ColumnName\":\"Key\",\"ColumnType\":\"string\"},{\"ColumnName\":\"Value\",\"ColumnType\":\"dynamic\"}],\"Rows\":[[1,\"Visualization\",\"{\\"Visualization\\":null,\\"Title\\":null,\\"XColumn\\":null,\\"Series\\":null,\\"YColumns\\":null,\\"AnomalyColumns\\":null,\\"XTitle\\":null,\\"YTitle\\":null,\\"XAxis\\":null,\\"YAxis\\":null,\\"Legend\\":null,\\"YSplit\\":null,\\"Accumulate\\":false,\\"IsQuerySorted\\":false,\\"Kind\\":null,\\"Ymin\\":\\"NaN\\",\\"Ymax\\":\\"NaN\\",\\"Xmin\\":null,\\"Xmax\\":null}\"]]},{\"FrameType\":\"DataTable\",\"TableId\":1,\"TableKind\":\"PrimaryResult\",\"TableName\":\"PrimaryResult\",\"Columns\":[{\"ColumnName\":\"data\",\"ColumnType\":\"dynamic\"}],\"Rows\":[]},{\"FrameType\":\"DataTable\",\"TableId\":2,\"TableKind\":\"QueryCompletionInformation\",\"TableName\":\"QueryCompletionInformation\",\"Columns\":[{\"ColumnName\":\"Timestamp\",\"ColumnType\":\"datetime\"},{\"ColumnName\":\"ClientRequestId\",\"ColumnType\":\"string\"},{\"ColumnName\":\"ActivityId\",\"ColumnType\":\"guid\"},{\"ColumnName\":\"SubActivityId\",\"ColumnType\":\"guid\"},{\"ColumnName\":\"ParentActivityId\",\"ColumnType\":\"guid\"},{\"ColumnName\":\"Level\",\"ColumnType\":\"int\"},{\"ColumnName\":\"LevelName\",\"ColumnType\":\"string\"},{\"ColumnName\":\"StatusCode\",\"ColumnType\":\"int\"},{\"ColumnName\":\"StatusCodeName\",\"ColumnType\":\"string\"},{\"ColumnName\":\"EventType\",\"ColumnType\":\"int\"},{\"ColumnName\":\"EventTypeName\",\"ColumnType\":\"string\"},{\"ColumnName\":\"Payload\",\"ColumnType\":\"string\"}],\"Rows\":[[\"2024-09-16T06:40:44.6158067Z\",\"QueryDemoe0e59a7e-dfd3-4bfd-8be2-cfa781db2f92\",\"3d3fc8fc-63a3-472c-a0b6-f8878dee0eb6\",\"99c13fd6-2cfe-4746-a59b-34b83fb0dfa3\",\"ae168864-3645-48d0-b9dd-aecafbe49d65\",4,\"Info\",0,\"S_OK (0)\",4,\"QueryInfo\",\"{\\"Count\\":1,\\"Text\\":\\"Query completed successfully\\"}\"],[\"2024-09-16T06:40:44.6158067Z\",\"QueryDemoe0e59a7e-dfd3-4bfd-8be2-cfa781db2f92\",\"3d3fc8fc-63a3-472c-a0b6-f8878dee0eb6\",\"99c13fd6-2cfe-4746-a59b-34b83fb0dfa3\",\"ae168864-3645-48d0-b9dd-aecafbe49d65\",4,\"Info\",0,\"S_OK (0)\",5,\"WorkloadGroup\",\"{\\"Count\\":1,\\"Text\\":\\"default\\"}\"],[\"2024-09-16T06:40:44.6158067Z\",\"QueryDemoe0e59a7e-dfd3-4bfd-8be2-cfa781db2f92\",\"3d3fc8fc-63a3-472c-a0b6-f8878dee0eb6\",\"99c13fd6-2cfe-4746-a59b-34b83fb0dfa3\",\"ae168864-3645-48d0-b9dd-aecafbe49d65\",4,\"Info\",0,\"S_OK (0)\",6,\"EffectiveRequestOptions\",\"{\\"Count\\":1,\\"Text\\":\\"{\\\\"DataScope\\\\":\\\\"All\\\\",\\\\"QueryConsistency\\\\":\\\\"strongconsistency\\\\",\\\\"MaxMemoryConsumptionPerIterator\\\\":2147483648,\\\\"MaxMemoryConsumptionPerQueryPerNode\\\\":2147483648,\\\\"QueryFanoutNodesPercent\\\\":100,\\\\"QueryFanoutThreadsPercent\\\\":100}\\"}\"],[\"2024-09-16T06:40:44.6158067Z\",\"QueryDemoe0e59a7e-dfd3-4bfd-8be2-cfa781db2f92\",\"3d3fc8fc-63a3-472c-a0b6-f8878dee0eb6\",\"99c13fd6-2cfe-4746-a59b-34b83fb0dfa3\",\"ae168864-3645-48d0-b9dd-aecafbe49d65\",6,\"Stats\",0,\"S_OK (0)\",0,\"QueryResourceConsumption\",\"{\\"ExecutionTime\\":0.0111178,\\"resource_usage\\":{\\"cache\\":{\\"shards\\":{\\"hot\\":{\\"hitbytes\\":0,\\"missbytes\\":0,\\"retrievebytes\\":0},\\"cold\\":{\\"hitbytes\\":0,\\"missbytes\\":0,\\"retrievebytes\\":0},\\"bypassbytes\\":0}},\\"cpu\\":{\\"user\\":\\"00:00:00.0156250\\",\\"kernel\\":\\"00:00:00\\",\\"total cpu\\":\\"00:00:00.0156250\\",\\"breakdown\\":{\\"query execution\\":\\"00:00:00.0156250\\",\\"query planning\\":\\"00:00:00\\"}},\\"memory\\":{\\"peak_per_node\\":10010912},\\"network\\":{\\"inter_cluster_total_bytes\\":584,\\"cross_cluster_total_bytes\\":0}},\\"input_dataset_statistics\\":{\\"extents\\":{\\"total\\":2,\\"scanned\\":0,\\"scanned_min_datetime\\":\\"0001-01-01T00:00:00.0000000Z\\",\\"scanned_max_datetime\\":\\"0001-01-01T00:00:00.0000000Z\\"},\\"rows\\":{\\"total\\":30181,\\"scanned\\":0},\\"rowstores\\":{\\"scanned_rows\\":0,\\"scanned_values_size\\":0},\\"shards\\":{\\"queries_generic\\":0,\\"queries_specialized\\":0}},\\"dataset_statistics\\":[{\\"table_row_count\\":0,\\"table_size\\":0}],\\"cross_cluster_resource_usage\\":{}}\"]]},{\"FrameType\":\"DataSetCompletion\",\"HasErrors\":false,\"Cancelled\":false}]"

AsafMah commented 2 months ago

Can you give an example of a value that may be in that table?

AsafMah commented 2 months ago

Can you also check if the same queries works in other contexts - like in Kusto Explorer or in the web ui?

AsafMah commented 1 month ago

Closing due to a lack of response, feel free to comment.