[
https://issues.apache.org/jira/browse/BEAM-5112?focusedWorklogId=178750&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-178750
]
ASF GitHub Bot logged work on BEAM-5112:
----------------------------------------
Author: ASF GitHub Bot
Created on: 26/Dec/18 19:42
Start Date: 26/Dec/18 19:42
Worklog Time Spent: 10m
Work Description: akedin commented on pull request #6417: [BEAM-5112] Use
Calcite codegen to implement BeamCalcRel
URL: https://github.com/apache/beam/pull/6417#discussion_r244037641
##########
File path:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##########
@@ -68,15 +121,90 @@ public Calc copy(RelTraitSet traitSet, RelNode input,
RexProgram program) {
BeamCalcRel.class.getSimpleName(),
pinput);
PCollection<Row> upstream = pinput.get(0);
+ Schema outputSchema = CalciteUtils.toSchema(getRowType());
+
+ final SqlConformance conformance = SqlConformanceEnum.MYSQL_5;
+ final JavaTypeFactory typeFactory =
+ new JavaTypeFactoryImpl(BeamRelDataTypeSystem.INSTANCE) {
+ @Override
+ public Type getJavaClass(RelDataType type) {
+ if (type instanceof BasicSqlType || type instanceof
IntervalSqlType) {
+ if (type.getSqlTypeName() == SqlTypeName.FLOAT) {
+ return type.isNullable() ? Float.class : float.class;
+ }
+ }
+ return super.getJavaClass(type);
+ }
+ };
+ final BlockBuilder builder = new BlockBuilder();
+
+ final PhysType physType =
+ PhysTypeImpl.of(typeFactory, getRowType(), JavaRowFormat.ARRAY,
false);
+
+ Expression input =
+ Expressions.convert_(Expressions.call(processContextParam,
"element"), Row.class);
+
+ final RexBuilder rexBuilder = getCluster().getRexBuilder();
+ final RelMetadataQuery mq = RelMetadataQuery.instance();
+ final RelOptPredicateList predicates =
mq.getPulledUpPredicates(getInput());
+ final RexSimplify simplify = new RexSimplify(rexBuilder, predicates,
false, RexUtil.EXECUTOR);
+ final RexProgram program =
BeamCalcRel.this.program.normalize(rexBuilder, simplify);
- BeamSqlExpressionExecutor executor = new
BeamSqlFnExecutor(BeamCalcRel.this.getProgram());
+ Expression condition =
+ RexToLixTranslator.translateCondition(
Review comment:
Should there be some validation of what is actually in `program` or is it
always safe to call `translateCondition`? What does it do?
----------------------------------------------------------------
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: 178750)
Time Spent: 2h 40m (was: 2.5h)
> Investigate if Calcite can generate functions that we need
> ----------------------------------------------------------
>
> Key: BEAM-5112
> URL: https://issues.apache.org/jira/browse/BEAM-5112
> Project: Beam
> Issue Type: Sub-task
> Components: dsl-sql
> Reporter: Rui Wang
> Assignee: Andrew Pilloud
> Priority: Major
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)