sunjincheng121 commented on a change in pull request #7167: [FLINK-10973] 
[table] Add support for map to table API
URL: https://github.com/apache/flink/pull/7167#discussion_r236970144
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/table.scala
 ##########
 @@ -999,6 +999,94 @@ class Table(
     new OverWindowedTable(this, overWindows.toArray)
   }
 
+  /**
+    * Performs a map operation with an user-defined scalar function or 
built-in scalar functions.
+    * The output will be flattened if the output type is a composite type.
+    *
+    * Scala Example:
+    * {{{
+    *   class MyMapFunction extends ScalarFunction {
+    *     def eval(str: String): Row = {
+    *       Row.of(str, str)
+    *     }
+    *
+    *     def getResultType(signature: Array[Class[_]]): TypeInformation[_] =
+    *       Types.ROW(Types.STRING, Types.STRING)
+    *   }
+    *
+    *   val func = new MyMapFunction()
+    *   table.map(func('c))
+    * }}}
+    *
+    * Java Example:
+    * {{{
+    *   class MyMapFunction extends ScalarFunction {
+    *     public Row eval(String str) {
+    *       return Row.of(str, str);
+    *     }
+    *
+    *     public TypeInformation getResultType(Class[] signature) {
+    *       return new RowTypeInfo(BasicTypeInfo.STRING_TYPE_INFO, 
BasicTypeInfo.STRING_TYPE_INFO);
 
 Review comment:
   Yes, I think so. Just make sure your thoughts. +1 using `flink-core`.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to