[
https://issues.apache.org/jira/browse/BEAM-4449?focusedWorklogId=108730&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-108730
]
ASF GitHub Bot logged work on BEAM-4449:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Jun/18 20:41
Start Date: 04/Jun/18 20:41
Worklog Time Spent: 10m
Work Description: akedin 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_r192808104
##########
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:
nit: would something like filterCondition be a better name? Also, it feels
like this condition handling should happen in the Calc Rel. Right now it looks
like the Filter Rel is just embedded here
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 108730)
Time Spent: 40m (was: 0.5h)
> 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: 40m
> 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)