Closed walterddr closed 1 year ago
solution:
instead of making Connection.resolveTableName
call into
private static String resolveTableName(String query) {
try {
return CalciteSqlCompiler.compileToBrokerRequest(query).querySource.tableName;
...
we should switch to
SqlNode sqlNode = CalciteSqlParser.extractSqlNodeAndOptions(query);
return CalciteSqlParser.extractTableNamesFromNode(sqlNode);
Please assign it to me. Thanks.
Question:
extractTableNamesFromNode
returns the List of the table names; what should we do for _brokerSelector.selectBroker
? Since the current implementation returns the broker address on which the table is hosted, multiple tables can be hosted on different brokers in the case of a JOIN query. Right?
For testing purposes, I passed the first table name to get the broker address, but later the query execution failed with the following error, got it working by just getting the broker for the first table name in the list.
This is a good question for how the routing is handling I would suggest check out here the controller logic. In https://github.com/apache/pinot/pull/10336 .
In fact the logic is so generic I think we should factor it to a utility. CC @ankitsultana @tibrewalpratik17
Yes, I was thinking the same about moving to some utility class.
Right now, the code is sitting in PinotQueryResource
getCommonBrokerTenant, which requires tableConfigs
and indirectly HelixResourceManger
.
I can give it a shot to move the functionality to some util class.
@walterddr : Any approach works for me. Long term though I wanted to move the parsing code out to a separate dedicated module, similar to how Presto has presto-parser.
cc: @Jackie-Jiang for his thoughts as well.
I think we need to make sure the broker picked is hosting all the tables within the JOIN, essentially do an intersection of multiple broker lists
We can close this issue. Thanks
see:
this is b/c the Connection code path doesn't go through the v2 engine (which only calls
CalciteSqlParser
for leaf stages, notCalciteSqlCompiler
for the overall query