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

Semantic analysis of joins using $left/$right syntax does not properly check for the presence of the refenced columns in their parent tables #105

Closed AlexDKlein closed 1 year ago

AlexDKlein commented 1 year ago

KustoCode.ParseAndAnalyze does not detect certain semantic errors when two tables are being joined using $left/$right syntax (e.g. A | join B on $left.X == $right.Y)

In the above example, if the schema specifies that table A contains no column X, but table Y does contain a column named X, no semantic errors will be identified. This behavior is commutative and does not depend on which table contains each column. In other words, if X and/or Y are found in either table, the parser will always miss the expected error.

More generally, this behavior occurs if either of the following are true:

These queries will not run, and the expected behavior is to return (up to) two semantic diagnostics with the messages: The column 'X' must exist on the left side of the join The column 'Y' must exist on the right side of the join

mattwar commented 1 year ago

Thanks for finding this bug. It has been fixed now.