rizaon commented on a change in pull request #1024:
URL: https://github.com/apache/orc/pull/1024#discussion_r796221728
##########
File path: c++/src/Reader.cc
##########
@@ -120,10 +120,24 @@ namespace orc {
bool ColumnSelector::selectParents(std::vector<bool>& selectedColumns, const
Type& type) {
size_t id = static_cast<size_t>(type.getColumnId());
bool result = selectedColumns[id];
+ uint64_t numSubtypeSelected = 0;
for(uint64_t c=0; c < type.getSubtypeCount(); ++c) {
- result |= selectParents(selectedColumns, *type.getSubtype(c));
+ if (selectParents(selectedColumns, *type.getSubtype(c))) {
+ result = true;
+ numSubtypeSelected++;
+ }
}
selectedColumns[id] = result;
+
+ if (type.getKind() == TypeKind::UNION && selectedColumns[id]) {
+ if (0 < numSubtypeSelected && numSubtypeSelected <
type.getSubtypeCount()) {
+ // Subtypes of UNION should be fully selected or not selected at all.
+ // Override partial subtype selections with full selections.
+ for (uint64_t c = 0; c < type.getSubtypeCount(); ++c) {
Review comment:
selectChildren will first check if type is selected or not. If type is
already selected, then selectChildren will stop checking type's children.
Hence, we iterate the children here and select them directly.
--
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]