xiangfu0 commented on a change in pull request #7590:
URL: https://github.com/apache/pinot/pull/7590#discussion_r736966334
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java
##########
@@ -1413,25 +1448,43 @@ private void fixColumnName(String rawTableName,
Expression expression, @Nullable
* - Case-insensitive cluster
* - Column name in the format of [table_name].[column_name]
*/
- private String getActualColumnName(String rawTableName, String columnName,
- @Nullable Map<String, String> columnNameMap) {
+ private static String getActualColumnName(String rawTableName, String
columnName,
+ @Nullable Map<String, String> columnNameMap, @Nullable Map<String,
String> aliasMap, boolean isCaseInsensitive) {
+ if ("*".equals(columnName)) {
+ return columnName;
+ }
// Check if column is in the format of [table_name].[column_name]
String[] splits = StringUtils.split(columnName, ".", 2);
- if (_tableCache.isCaseInsensitive()) {
+ if (isCaseInsensitive) {
if (splits.length == 2 && rawTableName.equalsIgnoreCase(splits[0])) {
columnName = splits[1];
}
+ String columnNameLowerCase = columnName.toLowerCase();
if (columnNameMap != null) {
- return columnNameMap.getOrDefault(columnName.toLowerCase(),
columnName);
- } else {
- return columnName;
+ String actualColumnName = columnNameMap.get(columnNameLowerCase);
+ if (actualColumnName != null) {
+ return actualColumnName;
+ }
+ }
+ if (aliasMap != null) {
+ String actualAlias = aliasMap.get(columnNameLowerCase);
+ if (actualAlias != null) {
+ return actualAlias;
+ }
}
} else {
if (splits.length == 2 && rawTableName.equals(splits[0])) {
columnName = splits[1];
}
- return columnName;
+ String columnNameLowerCase = columnName.toLowerCase();
Review comment:
columnNameMap is always using lower case column name as the key. Do you
mean we should let use the real column name as the key for case sensitive?
Say schema has column `Col`, then columnMap is always `col:Col`.
--
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]