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 2021/10/14 16:02:11 UTC

[GitHub] [flink] Airblader commented on a change in pull request #17483: [FLINK-24547][Table SQL / Planner]A function named row_kind() can get…

Airblader commented on a change in pull request #17483:
URL: https://github.com/apache/flink/pull/17483#discussion_r729124623



##########
File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/GenerateUtils.scala
##########
@@ -504,6 +504,19 @@ object GenerateUtils {
     GeneratedExpression(resultTerm, NEVER_NULL, resultCode, resultType)
   }
 
+  def generateRowKind(ctx: CodeGeneratorContext): GeneratedExpression = {
+    val resultType = new VarCharType(2)
+    val resultTypeTerm = primitiveTypeTermForType(resultType)
+    val resultTerm = ctx.addReusableLocalVariable(resultTypeTerm, "rowKind")
+    val resultCode =
+      s"""
+         |$resultTerm = org.apache.flink.table.data.binary.BinaryStringData.fromString(
+         |$DEFAULT_INPUT1_TERM.getRowKind().shortString());
+         |""".stripMargin.trim
+    // the proctime has been materialized, so it's TIMESTAMP now, not PROCTIME_INDICATOR

Review comment:
       This comment makes no sense. Copy paste?

##########
File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/StringCallGen.scala
##########
@@ -223,6 +222,9 @@ object StringCallGen {
           isCharacterString(operands(2).resultType) =>
         methodGen(BuiltInMethods.CONVERT_TZ)
 
+      case org.apache.flink.table.planner.functions.sql.FlinkSqlOperatorTable.ROW_KIND =>

Review comment:
       Please import `ROW_KIND` to shorten this.




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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org