pnowojski commented on a change in pull request #6299: [FLINK-9713][table][sql] 
Support processing time versioned joins
URL: https://github.com/apache/flink/pull/6299#discussion_r219213980
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/calcite/RelTimeIndicatorConverter.scala
 ##########
 @@ -442,11 +402,63 @@ class RexTimeIndicatorMaterializer(
 
       // materialize function's result and operands
       case _ if isTimeIndicatorType(updatedCall.getType) =>
-        updatedCall.clone(timestamp, materializedOperands)
+        updatedCall.clone(materializerUtils.getTimestamp, materializedOperands)
 
       // materialize function's operands only
       case _ =>
         updatedCall.clone(updatedCall.getType, materializedOperands)
     }
   }
 }
+
+/**
+  * Helper class for shared logic of materializing time attributes in 
[[RelNode]] and [[RexNode]].
+  */
+class RexTimeIndicatorMaterializerUtils(rexBuilder: RexBuilder) {
+
+  private val timestamp = rexBuilder
+    .getTypeFactory
+    .asInstanceOf[FlinkTypeFactory]
+    .createTypeFromTypeInfo(SqlTimeTypeInfo.TIMESTAMP, isNullable = false)
+
+  def getTimestamp: RelDataType = {
+    timestamp
+  }
+
+  def projectAndMaterializeFields(input: RelNode, indicesToMaterialize: 
Set[Int]) : RelNode = {
+    val projects = input.getRowType.getFieldList.map { field =>
+      materializeIfContains(
+        new RexInputRef(field.getIndex, field.getType),
+        field.getIndex,
+        indicesToMaterialize)
+    }
+
+    LogicalProject.create(
 
 Review comment:
   I know, but I think there is no need to complicate the logic here (and in 
other similar places), when we can relay on other simply optimisation rules 
like merging projections.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to