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

.create mapping / .create-or-alter mapping have different parsing tree #114

Closed vplauzon closed 1 year ago

vplauzon commented 1 year ago

Although it is nearly the same command, the 2 commands yield different syntax tree.

jkindwall commented 1 year ago

Seems likely this is related to an issue I'm having. I'm trying to use KustoCode.ParseAndAnalyze to validate a bunch of .kql files that we have checked in to our source control in an attempt to catch errors before we try to deploy schema changes to the database.

We have several files that contain commands such as this:

.create-or-alter table ["<table name>"] ingestion json mapping "<mapping name>"
@'['
'  {'
'    "Column": "Column1",'
'    "DataType": "",'
'    "Path": "$column1"'
'  },'
'  {'
'    "Column": "Column2",'
'    "DataType": "",'
'    "Path": "$column2"'
'  },'
...
']'

Every time we try ParseAndAnalyze on one of these commands, we are getting Diagnostic errors like this:

Severity: Error Code: KS005 Category: General Message: Expected: workload_group Start: 17 End: 22

and this:

Severity: Error Code: KS006 Category General Message: Missing string Start: 22 End: 22

mattwar commented 1 year ago

These parsing errors for commands should be resolved in the most recent 11.3.1 version.

You will also need to use multi-line string literals using ``` as quotes instead of multiple single line string literals which are not supported in command syntax.