You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/05/13 15:28:10 UTC

[GitHub] [calcite] rubenada opened a new pull request, #2806: [CALCITE-5061] Improve recursive application of the field trimming

rubenada opened a new pull request, #2806:
URL: https://github.com/apache/calcite/pull/2806

   [CALCITE-5061](https://issues.apache.org/jira/browse/CALCITE-5061) - Improve recursive application of the field trimming: if a RelNode itself cannot be trimmed, try to trim inside its subtree as much as possible


-- 
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: commits-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] rubenada commented on pull request #2806: [CALCITE-5061] Improve recursive application of the field trimming

Posted by GitBox <gi...@apache.org>.
rubenada commented on PR #2806:
URL: https://github.com/apache/calcite/pull/2806#issuecomment-1127408782

   Thanks for the review @hsyuan @chunweilei .
   I have squashed commits into a single one. I will merge this PR in the coming days if no objection appears.


-- 
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: commits-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] rubenada commented on a diff in pull request #2806: [CALCITE-5061] Improve recursive application of the field trimming

Posted by GitBox <gi...@apache.org>.
rubenada commented on code in PR #2806:
URL: https://github.com/apache/calcite/pull/2806#discussion_r873436333


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -352,11 +352,24 @@ public TrimResult trimFields(
       RelNode rel,
       ImmutableBitSet fieldsUsed,
       Set<RelDataTypeField> extraFields) {
-    // We don't know how to trim this kind of relational expression, so give
-    // it back intact.
+    // We don't know how to trim this kind of relational expression
     Util.discard(fieldsUsed);
-    return result(rel,
-        Mappings.createIdentity(rel.getRowType().getFieldCount()));
+    if (rel.getInputs().isEmpty()) {
+      return result(rel, Mappings.createIdentity(rel.getRowType().getFieldCount()));
+    }
+
+    // We don't know how to trim this RelNode, but we can try to trim inside its inputs
+    List<RelNode> newInputs = new ArrayList<>(rel.getInputs().size());
+    for (RelNode input : rel.getInputs()) {
+      ImmutableBitSet inputFieldsUsed = ImmutableBitSet.range(input.getRowType().getFieldCount());
+      TrimResult trimResult = dispatchTrimFields(input, inputFieldsUsed, extraFields);
+      if (!trimResult.right.isIdentity()) {
+        throw new IllegalArgumentException();
+      }

Review Comment:
   Exception message improved.



-- 
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: commits-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] chunweilei commented on a diff in pull request #2806: [CALCITE-5061] Improve recursive application of the field trimming

Posted by GitBox <gi...@apache.org>.
chunweilei commented on code in PR #2806:
URL: https://github.com/apache/calcite/pull/2806#discussion_r873279078


##########
core/src/main/java/org/apache/calcite/sql2rel/RelFieldTrimmer.java:
##########
@@ -352,11 +352,24 @@ public TrimResult trimFields(
       RelNode rel,
       ImmutableBitSet fieldsUsed,
       Set<RelDataTypeField> extraFields) {
-    // We don't know how to trim this kind of relational expression, so give
-    // it back intact.
+    // We don't know how to trim this kind of relational expression
     Util.discard(fieldsUsed);
-    return result(rel,
-        Mappings.createIdentity(rel.getRowType().getFieldCount()));
+    if (rel.getInputs().isEmpty()) {
+      return result(rel, Mappings.createIdentity(rel.getRowType().getFieldCount()));
+    }
+
+    // We don't know how to trim this RelNode, but we can try to trim inside its inputs
+    List<RelNode> newInputs = new ArrayList<>(rel.getInputs().size());
+    for (RelNode input : rel.getInputs()) {
+      ImmutableBitSet inputFieldsUsed = ImmutableBitSet.range(input.getRowType().getFieldCount());
+      TrimResult trimResult = dispatchTrimFields(input, inputFieldsUsed, extraFields);
+      if (!trimResult.right.isIdentity()) {
+        throw new IllegalArgumentException();
+      }

Review Comment:
   > throw new IllegalArgumentException();
   
   Should we add some clear exception messages instead?



-- 
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: commits-unsubscribe@calcite.apache.org

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


[GitHub] [calcite] rubenada merged pull request #2806: [CALCITE-5061] Improve recursive application of the field trimming

Posted by GitBox <gi...@apache.org>.
rubenada merged PR #2806:
URL: https://github.com/apache/calcite/pull/2806


-- 
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: commits-unsubscribe@calcite.apache.org

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