You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2022/02/01 10:33:51 UTC

[GitHub] [orc] stiga-huang commented on a change in pull request #1024: ORC-1099: [C++] Extend ReadIntent to support MAP and UNION type

stiga-huang commented on a change in pull request #1024:
URL: https://github.com/apache/orc/pull/1024#discussion_r796459654



##########
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:
       Ah, right. Thanks for the explanation!




-- 
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: dev-unsubscribe@orc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org