[feature-wip][multi-catalog]Support caseSensitive field name in file scan node (#11310)

* Impl case sentive in file scan node
This commit is contained in:
huangzhaowei
2022-08-05 08:03:16 +08:00
committed by GitHub
parent b5531c5caf
commit 6eb8ac0ebf
10 changed files with 57 additions and 18 deletions

View File

@ -222,6 +222,14 @@ public class BrokerUtil {
public static List<String> parseColumnsFromPath(String filePath, List<String> columnsFromPath)
throws UserException {
return parseColumnsFromPath(filePath, columnsFromPath, true);
}
public static List<String> parseColumnsFromPath(
String filePath,
List<String> columnsFromPath,
boolean caseSensitive)
throws UserException {
if (columnsFromPath == null || columnsFromPath.isEmpty()) {
return Collections.emptyList();
}
@ -246,7 +254,8 @@ public class BrokerUtil {
throw new UserException("Fail to parse columnsFromPath, expected: "
+ columnsFromPath + ", filePath: " + filePath);
}
int index = columnsFromPath.indexOf(pair[0]);
String parsedColumnName = caseSensitive ? pair[0] : pair[0].toLowerCase();
int index = columnsFromPath.indexOf(parsedColumnName);
if (index == -1) {
continue;
}

View File

@ -274,7 +274,7 @@ public class HudiScanNode extends BrokerScanNode {
TScanRangeLocations curLocations = newLocations(context.params, brokerDesc);
List<String> partitionValuesFromPath = BrokerUtil.parseColumnsFromPath(fileSplit.getPath().toString(),
getPartitionKeys());
getPartitionKeys(), false);
int numberOfColumnsFromFile = context.slotDescByName.size() - partitionValuesFromPath.size();
TBrokerRangeDesc rangeDesc = createBrokerRangeDesc(fileSplit, fileFormatType,

View File

@ -309,7 +309,7 @@ public class ExternalFileScanNode extends ExternalScanNode {
totalFileSize += split.getLength();
List<String> partitionValuesFromPath = BrokerUtil.parseColumnsFromPath(fileSplit.getPath().toString(),
partitionKeys);
partitionKeys, false);
TFileRangeDesc rangeDesc = createFileRangeDesc(fileSplit, partitionValuesFromPath);