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

Can it do column mapping? #92

Closed poppy0708 closed 1 year ago

poppy0708 commented 1 year ago

Hi,

Can I achieve column mapping through this parser? Known it can analysis the columns that was referenced by a query, while how about the column mapping relationship to the result set column. For example, there is a query: T |project col1, col2, col3 |summarize arg1 = max(col1) by col2, col3 |project arg1, arg2 = col2, arg3 =col3 Can it infer the information that arg1 origin from col1, arg2 from col2, arg3 from col3?

Thank you!

poppy0708 commented 1 year ago

I also found that only of the column name is explicitly called out, it is returned in GetDatabaseTableColumns result. If I use "project-away col1", I expect all other columns return besides col1, while it returns null. If I use "project-reorder", I expect all columns are returned, while it returns null.

Is this a bug?

mattwar commented 1 year ago

The GetDatabaseTableColumns function only returns columns that are explicitly referenced in the query. If you want to know the set of columns returned by the query you can examine the KustoCode.ResultType property. It should contain a TableSymbol with all the columns.

poppy0708 commented 1 year ago

Thanks for your confirmation, Matt