abhishekagarwal87 commented on code in PR #12418:
URL: https://github.com/apache/druid/pull/12418#discussion_r851058217
##########
sql/src/main/java/org/apache/druid/sql/calcite/rel/DruidQuery.java:
##########
@@ -1199,14 +1199,25 @@ private ScanQuery toScanQuery(final
QueryFeatureInspector queryFeatureInspector)
orderByColumns = Collections.emptyList();
}
- if (!queryFeatureInspector.feature(QueryFeature.SCAN_CAN_ORDER_BY_NON_TIME)
- && (orderByColumns.size() > 1
- || orderByColumns.stream()
- .anyMatch(orderBy ->
!orderBy.getColumnName().equals(ColumnHolder.TIME_COLUMN_NAME)))) {
- // Cannot handle this ordering.
- // Scan cannot ORDER BY non-time columns.
- plannerContext.setPlanningError("SQL query requires order by non-time
column %s that is not supported.", orderByColumns);
- return null;
+ if
(!queryFeatureInspector.feature(QueryFeature.SCAN_CAN_ORDER_BY_NON_TIME) &&
!orderByColumns.isEmpty()) {
+ if (orderByColumns.size() > 1 ||
!ColumnHolder.TIME_COLUMN_NAME.equals(orderByColumns.get(0).getColumnName())) {
+ // Cannot handle this ordering.
+ // Scan cannot ORDER BY non-time columns.
+ plannerContext.setPlanningError(
+ "SQL query requires order by non-time column %s that is not
supported.",
+ orderByColumns
+ );
+ return null;
+ }
+ if (!dataSource.isConcrete()) {
+ // Cannot handle this ordering.
+ // Scan cannot ORDER BY non-time columns.
+ plannerContext.setPlanningError(
+ "SQL query requires order by non-time column on a datasource[%s],
which is not supported.",
+ dataSource
Review Comment:
I realized that this message is incorrect. You already checked that the
column being ordered on is a time column.
```suggestion
plannerContext.setPlanningError(
"SQL query is a scan and requires order by on a datasource of
type[%s], which is not supported.",
dataSource.getType()
```
--
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]