You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/21 11:40:58 UTC

[GitHub] [flink] wuchong commented on a change in pull request #12260: [FLINK-17189][table-planner] Table with proctime attribute cannot be read from Hive catalog

wuchong commented on a change in pull request #12260:
URL: https://github.com/apache/flink/pull/12260#discussion_r428601204



##########
File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/sources/TableSourceUtil.scala
##########
@@ -238,6 +250,14 @@ object TableSourceUtil {
     }
   }
 
+  private def containsTimeAttribute(tableSchema: TableSchema): Boolean = {
+    tableSchema.getWatermarkSpecs.nonEmpty || tableSchema.getTableColumns.exists(isProctime)
+  }
+
+  private def isProctime(column: TableColumn): Boolean = {
+    toScala(column.getExpr).exists(_.equalsIgnoreCase("proctime()"))
+  }

Review comment:
       I think this is error-prone. The string compare is not a general solution, I can come up with some corner cases: 
   ```
   `proctime()`  // quoted
   proctime // function identifier
   ```
   
   I think a more general solution is pass a `SqlExprToRexConverterFactory` (which can creates a `SqlExprToRexConverter` to get the correct type of an expression) into the `CatalogSchemaTable`. I know it's verbose to pass it into `CatalogSchemaTable`, but I don't find other reasonable ways. 




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