flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] wuchong commented on a change in pull request #10224: [FLINK-14716][table-planner-blink] Cooperate computed column with push down rules
Date Mon, 18 Nov 2019 08:31:10 GMT
wuchong commented on a change in pull request #10224: [FLINK-14716][table-planner-blink] Cooperate
computed column with push down rules
URL: https://github.com/apache/flink/pull/10224#discussion_r347247673
 
 

 ##########
 File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/schema/TableSourceTable.scala
 ##########
 @@ -19,45 +19,56 @@
 package org.apache.flink.table.planner.plan.schema
 
 import org.apache.flink.table.catalog.CatalogTable
-import org.apache.flink.table.planner.calcite.FlinkTypeFactory
 import org.apache.flink.table.planner.plan.stats.FlinkStatistic
-import org.apache.flink.table.planner.sources.TableSourceUtil
 import org.apache.flink.table.sources.{TableSource, TableSourceValidation}
-import org.apache.calcite.rel.`type`.{RelDataType, RelDataTypeFactory}
+
+import org.apache.calcite.rel.`type`.RelDataType
 import org.apache.flink.shaded.guava18.com.google.common.base.Preconditions
 import org.apache.flink.table.api.{TableException, WatermarkSpec}
-import org.apache.flink.table.types.logical.{TimestampKind, TimestampType}
+import org.apache.flink.table.planner.calcite.FlinkToRelContext
+
+import org.apache.calcite.plan.{RelOptSchema, RelOptTable}
+import org.apache.calcite.rel.RelNode
+import org.apache.calcite.rel.logical.LogicalTableScan
+
+import java.util.{List => JList}
 
 import scala.collection.JavaConverters._
+import scala.collection.JavaConversions._
 
 /**
-  * Abstract class which define the interfaces required to convert a [[TableSource]] to
-  * a Calcite Table
+  * Abstract class which define the implementations required to translate
+  * the Calcite [[RelOptTable]] to the Flink specific relational expression with [[TableSource]],
+  * i.e. The computed column and watermark strategy specifications.
+  *
+  * <p>It also defines the [[copy]] method used for push down rules.
   *
-  * @param tableSource The [[TableSource]] for which is converted to a Calcite Table.
-  * @param isStreamingMode A flag that tells if the current table is in stream mode.
-  * @param statistic The table statistics.
+  * @param tableSource The [[TableSource]] for which is converted to a Calcite Table
+  * @param isStreamingMode A flag that tells if the current table is in stream mode
+  * @param catalogTable Catalog table where this table source table comes from
   */
 class TableSourceTable[T](
+    relOptSchema: RelOptSchema,
+    names: JList[String],
+    rowType: RelDataType,
 
 Review comment:
   -1 to hard code `rowType` out of `TableSourceTable`. This is error-prone.
   
   It's hard to make sure the the user-defined rowtype is the same as the output type of `TableSourceTable`,
   unless user use the right util method and the right parameters to compute the rowtype,
e.g. there are 3 `getSourceRowType` in `TableSourceUtil`, and use `CatalogTable#tableSchema`
or `TableSource#tableSchema` as the parameter will get different/wrong rowType.
   
   The `rowType` of `TableSourceTable` can be and should be self-defined. The constructor
of `TableSourceTable` shouldn't care about the rowType, because all of the constructor parameters
will affect the `rowType`, incl. `tableSource`, and `tableSource` might change (see `copy(tableSource:
TableSource[_], statistic: FlinkStatistic)`).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message