yuanlihan commented on a change in pull request #1629: Enable parsing columns
from file path for Broker Load (#1582)
URL: https://github.com/apache/incubator-doris/pull/1629#discussion_r313250651
##########
File path: fe/src/main/java/org/apache/doris/planner/BrokerScanNode.java
##########
@@ -696,9 +699,40 @@ private TBrokerRangeDesc createBrokerRangeDesc(long
curFileOffset, TBrokerFileSt
rangeDesc.setStart_offset(curFileOffset);
rangeDesc.setSize(rangeBytes);
rangeDesc.setFile_size(fileStatus.size);
+ rangeDesc.setColumns_from_path(columnsFromPath);
return rangeDesc;
}
+ private Map<String, String> parseColumnsFromPath(String filePath,
List<String> columnsFromPath) throws UserException {
+ if (columnsFromPath == null || columnsFromPath.isEmpty()) {
+ return Collections.emptyMap();
+ }
+ String[] strings = filePath.split("/");
+ Map<String, String> columns = new HashMap<>();
+ for (int i = strings.length - 1; i >= 0; i--) {
+ String str = strings[i];
+ if (str == null || str.isEmpty() || !str.contains("=")) {
Review comment:
> When we meet a path like "/xx/yy/zz/k1=1/aa", I think we should think this
path is not a valid path. We only accept paths like "xx/yy/zz/aa/k1=1"
I will raise an exception here.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]