-
Notifications
You must be signed in to change notification settings - Fork 569
[GLUTEN-10745][VL] Refactor parseScanSplitInfo for VeloxPlanConverter #10742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
beliefer
wants to merge
1
commit into
apache:main
Choose a base branch
from
beliefer:improve-parseScanSplitInfo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,27 +46,31 @@ std::shared_ptr<SplitInfo> parseScanSplitInfo( | |
| using SubstraitFileFormatCase = ::substrait::ReadRel_LocalFiles_FileOrFiles::FileFormatCase; | ||
|
|
||
| auto splitInfo = std::make_shared<SplitInfo>(); | ||
| splitInfo->paths.reserve(fileList.size()); | ||
| splitInfo->starts.reserve(fileList.size()); | ||
| splitInfo->lengths.reserve(fileList.size()); | ||
| splitInfo->partitionColumns.reserve(fileList.size()); | ||
| splitInfo->properties.reserve(fileList.size()); | ||
| splitInfo->metadataColumns.reserve(fileList.size()); | ||
| const size_t fileCount = fileList.size(); | ||
|
|
||
| splitInfo->paths.reserve(fileCount); | ||
| splitInfo->starts.reserve(fileCount); | ||
| splitInfo->lengths.reserve(fileCount); | ||
| splitInfo->partitionColumns.reserve(fileCount); | ||
| splitInfo->properties.reserve(fileCount); | ||
| splitInfo->metadataColumns.reserve(fileCount); | ||
| for (const auto& file : fileList) { | ||
| // Expect all Partitions share the same index. | ||
| splitInfo->partitionIndex = file.partition_index(); | ||
|
|
||
| std::unordered_map<std::string, std::string> partitionColumnMap; | ||
| partitionColumnMap.reserve(file.partition_columns_size()); | ||
| for (const auto& partitionColumn : file.partition_columns()) { | ||
| partitionColumnMap[partitionColumn.key()] = partitionColumn.value(); | ||
| partitionColumnMap.emplace(partitionColumn.key(), partitionColumn.value()); | ||
| } | ||
| splitInfo->partitionColumns.emplace_back(partitionColumnMap); | ||
| splitInfo->partitionColumns.emplace_back(std::move(partitionColumnMap)); | ||
|
|
||
| std::unordered_map<std::string, std::string> metadataColumnMap; | ||
| metadataColumnMap.reserve(file.metadata_columns_size()); | ||
| for (const auto& metadataColumn : file.metadata_columns()) { | ||
| metadataColumnMap[metadataColumn.key()] = metadataColumn.value(); | ||
| metadataColumnMap.emplace(metadataColumn.key(), metadataColumn.value()); | ||
| } | ||
| splitInfo->metadataColumns.emplace_back(metadataColumnMap); | ||
| splitInfo->metadataColumns.emplace_back(std::move(metadataColumnMap)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
|
|
||
| splitInfo->paths.emplace_back(file.uri_file()); | ||
| splitInfo->starts.emplace_back(file.start()); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if the partitionColumnMap isEmpty first
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::moveis safe here even ifpartitionColumnMapis empty.emplace_backcould accept the emptypartitionColumnMap.The overhead of
std::moveis very small and check if thepartitionColumnMapisEmpty brings extra overhead.I will change the code as you said if you insist. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the interface, if the table is not a partitioned table, we should not set the field, I miss an issue before, #10622
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happened if we set the field with empty
partitionColumnMap?