microsoft / Kusto-Query-Language

Kusto Query Language is a simple and productive language for querying Big Data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

AlexDKlein opened this issue · comments

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:

  • Both columns referenced by the join are found in the same table and do not exist in the other.
  • The left-hand table only contains the $right column and the right-hand table only contains the $left column.

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

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