microsoft / Kusto-Query-Language

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

GetSyntaxDiagnostics() returns errors for valid command #98

Closed mbaranovych closed 1 year ago

mbaranovych commented 1 year ago

Hi team, could you please assist?

We have the following command:

.create-or-alter function with (docstring= "Docs", folder = "FolderPath", skipvalidation = "true") Function_Name(startTime:datetime, lookbackPeriod:timespan) {
    MyTable
    ...
    | where kind == 1 // this line causes problems
}

GetSyntaxDiagnostics() returns list of Diagnostic with unclear messages: "Expected: = Expected: token Missing expression Expected: }".

When I am trying to apply command in Kusto - everything is fine, no syntax or other errors. If I try to add | where kind == 1 to any existing valid command with function - GetSyntaxDiagnostics returns some errors.

Kusto.Language Version=11.0.0.0

Any ideas what could be wrong?

sloutsky commented 1 year ago

'kind' is a reserved word, you should use ['kind'] instead:

https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/schema-entities/entity-names#identifier-quoting

mbaranovych commented 1 year ago

@sloutsky is there any way to see it in Diagnostics? I inspected everything I could, didn't find any proper error message.