[ 
https://issues.apache.org/jira/browse/BEAM-4449?focusedWorklogId=109096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-109096
 ]

ASF GitHub Bot logged work on BEAM-4449:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Jun/18 14:54
            Start Date: 05/Jun/18 14:54
    Worklog Time Spent: 10m 
      Work Description: kennknowles commented on a change in pull request 
#5544: [BEAM-4449] Replace project and filter with calc
URL: https://github.com/apache/beam/pull/5544#discussion_r193103018
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/interpreter/BeamSqlFnExecutor.java
 ##########
 @@ -123,24 +126,29 @@
  * evaluated against the {@link Row}.
  */
 public class BeamSqlFnExecutor implements BeamSqlExpressionExecutor {
-  protected List<BeamSqlExpression> exps;
-
-  public BeamSqlFnExecutor(BeamRelNode relNode) {
-    this.exps = new ArrayList<>();
-    if (relNode instanceof BeamFilterRel) {
-      BeamFilterRel filterNode = (BeamFilterRel) relNode;
-      RexNode condition = filterNode.getCondition();
-      exps.add(buildExpression(condition));
-    } else if (relNode instanceof BeamProjectRel) {
-      BeamProjectRel projectNode = (BeamProjectRel) relNode;
-      List<RexNode> projects = projectNode.getProjects();
-      for (RexNode rexNode : projects) {
-        exps.add(buildExpression(rexNode));
-      }
-    } else {
-      throw new UnsupportedOperationException(
-          String.format("%s is not supported yet!", 
relNode.getClass().toString()));
-    }
+  private List<BeamSqlExpression> exprs;
+  private BeamSqlExpression condition;
+  private List<BeamSqlExpression> projects;
+
+  public BeamSqlFnExecutor(RexProgram program) {
+    this.exprs =
+        program
+            .getExprList()
+            .stream()
+            .map(BeamSqlFnExecutor::buildExpression)
+            .collect(Collectors.toList());
+
+    this.condition =
 
 Review comment:
   Yes, done.
   
   And that is exactly right. A Calc runs a RexProgram, which is a list of 
projections plus a filter combined into one thing, because it is easier to 
optimize than project and filter.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 109096)
    Time Spent: 1h 50m  (was: 1h 40m)

> Use Calc instead of Project and Filter separately
> -------------------------------------------------
>
>                 Key: BEAM-4449
>                 URL: https://issues.apache.org/jira/browse/BEAM-4449
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Kenneth Knowles
>            Assignee: Kenneth Knowles
>            Priority: Major
>          Time Spent: 1h 50m
>  Remaining Estimate: 0h
>
> Calcite has a combined Calc operator that is amenable to more optimization, 
> and also means less code to manage as we adjust how the operators/expressions 
> are implemented.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to