KurtYoung commented on a change in pull request #10123: 
[FLINK-14665][table-planner-blink] Support computed column for create…
URL: https://github.com/apache/flink/pull/10123#discussion_r344422724
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/calcite/FlinkPlannerImpl.scala
 ##########
 @@ -151,37 +151,36 @@ class FlinkPlannerImpl(
     new SqlExprToRexConverterImpl(config, typeFactory, cluster, tableRowType)
   }
 
-  /** Implements [[org.apache.calcite.plan.RelOptTable.ViewExpander]]
-    * interface for [[org.apache.calcite.tools.Planner]]. */
-  class ViewExpanderImpl extends ViewExpander {
-
-    override def expandView(
-        rowType: RelDataType,
-        queryString: String,
-        schemaPath: util.List[String],
-        viewPath: util.List[String]): RelRoot = {
-
-      val sqlNode = parser.parse(queryString)
-      val catalogReader = catalogReaderSupplier.apply(false)
-        .withSchemaPath(schemaPath)
-      val validator =
-        new FlinkCalciteSqlValidator(operatorTable, catalogReader, typeFactory)
-      validator.setIdentifierExpansion(true)
-      val validatedSqlNode = validator.validate(sqlNode)
-      val sqlToRelConverter = new SqlToRelConverter(
-        new ViewExpanderImpl,
-        validator,
-        catalogReader,
-        cluster,
-        convertletTable,
-        sqlToRelConverterConfig)
-      root = sqlToRelConverter.convertQuery(validatedSqlNode, true, false)
-      root = root.withRel(sqlToRelConverter.flattenTypes(root.project(), true))
-      root = root.withRel(RelDecorrelator.decorrelateQuery(root.project()))
-      FlinkPlannerImpl.this.root
-    }
+  override def getCluster: RelOptCluster = cluster
+
+  override def expandView(
+      rowType: RelDataType,
+      queryString: String,
+      schemaPath: util.List[String],
+      viewPath: util.List[String]): RelRoot = {
+
+    val sqlNode: SqlNode = parser.parse(queryString)
 
 Review comment:
   According to scala coding style:
   
   > You should almost never annotate the type of a private field or a local 
variable. However, you may wish to still display the type where the assigned 
value has a complex or non-obvious form.
   
   I don't think any local variable in this function needs to declare type 
explicitly, since most types are showed by variable name

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to