microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.
Apache License 2.0
510 stars 97 forks source link

GetDiagnostics fails to report an error in the query. #81

Closed DeepakRautela02 closed 1 year ago

DeepakRautela02 commented 1 year ago

I have been trying to use the GetDiagnostics() method to find the syntactic and semantic errors in my queries, but when I came across the following query, the Diagnostics object didn't report any error.

Tablename | where ColumnName == datetime('DummyString')

But, When I ran the same query in the portal, I got a syntax error as below:

Syntax error: Failed to parse datetime literal: 'datetime('DummyString')'

The Diagnostics object should have reported this error in my opinion, but it didn't.

mattwar commented 1 year ago

The parser does not attempt to translate the contents of literals, especially literals like datetime, since the implementation would be based on runtime libraries that are not consistent between dotnet and javascript, and the knowing the actual value is not necessary for implementing client intellisense. The server, of course, needs the actual value to function so it fails.