jackjlli commented on a change in pull request #7590: URL: https://github.com/apache/pinot/pull/7590#discussion_r734026696
########## File path: pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java ########## @@ -1396,14 +1413,41 @@ private void fixColumnName(String rawTableName, TransformExpressionTree expressi /** * Fixes the column names to the actual column names in the given SQL expression. */ - private void fixColumnName(String rawTableName, Expression expression, @Nullable Map<String, String> columnNameMap) { + @VisibleForTesting + private static void fixColumnName(String rawTableName, Expression expression, + @NotNull Map<String, String> columnNameMap, @NotNull Map<String, String> aliasMap, boolean isCaseInsensitive) { ExpressionType expressionType = expression.getType(); if (expressionType == ExpressionType.IDENTIFIER) { Identifier identifier = expression.getIdentifier(); - identifier.setName(getActualColumnName(rawTableName, identifier.getName(), columnNameMap)); + final String actualColumnName = + getActualColumnName(rawTableName, identifier.getName(), columnNameMap, aliasMap, isCaseInsensitive); + if (columnNameMap.containsValue(actualColumnName)) { + identifier.setName(actualColumnName); + } else if (aliasMap.containsValue(actualColumnName)) { + identifier.setName(actualColumnName); + } else if (!"*".equals(actualColumnName)) { + throw new BadQueryRequestException("Unknown columnName '" + identifier.getName() + "' found in the query"); Review comment: Directly throwing an exception would immediately break some of the existing use cases which are running with invalid column names. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org