gianm commented on code in PR #18235:
URL: https://github.com/apache/druid/pull/18235#discussion_r2208783803
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/DataServerQueryHandler.java:
##########
@@ -195,7 +200,36 @@ public <RowType, QueryType> DataServerQueryResult<RowType>
fetchRowsFromDataServ
}
}
- return new DataServerQueryResult<>(yielders, handedOffSegments,
dataSource);
+ return new DataServerQueryResult<>(yielders, handedOffSegments,
dataSourceName);
+ }
+
+ /**
+ * Transform {@link InputNumberDataSource}s, which are only understood by
MSQ tasks, back into a
+ * {@link TableDataSource}.
+ */
+ private DataSource transformDatasource(DataSource dataSource)
+ {
+ if (dataSource instanceof InputNumberDataSource) {
+ InputNumberDataSource numberDataSource = (InputNumberDataSource)
dataSource;
+ if (numberDataSource.getInputNumber() == inputNumber) {
+ return new TableDataSource(dataSourceName);
+ } else {
+ throw DruidException.forPersona(DruidException.Persona.USER)
+ .ofCategory(DruidException.Category.UNSUPPORTED)
+ .build(
+ "Cannot handle joining two sources (like
unions or broadcast joins) while "
Review Comment:
Suggested clearer message:
> Cannot handle stage with multiple sources while querying realtime data. If
using broadcast joins, try setting[sqlJoinAlgorithm] to[sortMerge] in your
query context.
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/exec/DataServerQueryHandler.java:
##########
@@ -195,7 +200,36 @@ public <RowType, QueryType> DataServerQueryResult<RowType>
fetchRowsFromDataServ
}
}
- return new DataServerQueryResult<>(yielders, handedOffSegments,
dataSource);
+ return new DataServerQueryResult<>(yielders, handedOffSegments,
dataSourceName);
+ }
+
+ /**
+ * Transform {@link InputNumberDataSource}s, which are only understood by
MSQ tasks, back into a
+ * {@link TableDataSource}.
+ */
+ private DataSource transformDatasource(DataSource dataSource)
+ {
+ if (dataSource instanceof InputNumberDataSource) {
+ InputNumberDataSource numberDataSource = (InputNumberDataSource)
dataSource;
Review Comment:
This should also have a branch to check for
`RestrictedInputNumberDataSource`. If it sees one, create a
`RestrictedDataSource` wrapping a `TableDataSource` using the correct `Policy`.
Please include a test for this. You don't need to include an end-to-end test; a
unit test for this function specifically is OK. To make it more testable,
consider making it `static`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]