jackjlli commented on a change in pull request #6361:
URL: https://github.com/apache/incubator-pinot/pull/6361#discussion_r620719548
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
##########
@@ -303,6 +299,31 @@ private DataTable processQuery(List<IndexSegment>
indexSegments, QueryContext qu
}
}
+ /**
+ * If all the segments are pruned, check whether it's caused by invalid
column name in the query.
+ * This is to keep the behavior consistent when new columns are added and
not all the segments have the new columns in their metadata;
+ * old segments may contain stale schema until the table is reloaded.
+ */
+ private void detectInvalidColumnIfExists(QueryContext queryContext,
DataTable dataTable) {
+ Set<String> columnNamesFromSchema =
_instanceDataManager.getColumnNamesByTable(queryContext.getTableName());
+ Set<String> columnNamesFromQuery = queryContext.getColumns();
+ // Validate whether column names in the query are valid
+ if (!columnNamesFromSchema.isEmpty() &&
!columnNamesFromSchema.containsAll(columnNamesFromQuery)) {
+ columnNamesFromQuery.removeAll(columnNamesFromSchema);
+
dataTable.getMetadata().put(MetadataKey.INVALID_COLUMN_IN_QUERY.getName(),
columnNamesFromQuery.toString());
Review comment:
Correct, that's exactly what we're doing in
`detectInvalidColumnIfExists` method.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]