azure-data-explorer-datasource
azure-data-explorer-datasource copied to clipboard
Improve auto-completion for query builder by using search string
Currently the auto completion for the query builder is initialized once with fixed values by the following query.
adx-<tablename>
| where isnotempty(<column_name>)
| take 50000
| distinct <column_name>
| take 251
The query to initialize the values is fixed to sample 50000 values and then take 251 distinct values from that sample.
For code see here: https://github.com/grafana/azure-data-explorer-datasource/blob/a8a6c09c8de44506a6eabeb72d47dfae8540b678/src/KustoExpressionParser.ts#L67-L69
Since we have more than 251 distinct values the auto complete does not show the correct values even when typing the correct prefixes. It seems like Grafana UI generally triggers a correct search (with search term), but this data source does not use it.
My improvement idea would be to correctly implement the auto complete function and use the typed search term for the auto completion if available.
adx-<tablename>
| where isnotempty(<column_name>)
| where <column_name> contains <search_string>
| take 50000
| distinct <column_name>
| take 251