hequn8128 commented on a change in pull request #8057: [FLINK-12028][table] Add
`addColumns`,`renameColumns`, `dropColumns` …
URL: https://github.com/apache/flink/pull/8057#discussion_r269861806
##########
File path:
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Table.java
##########
@@ -879,4 +879,117 @@
* @return An OverWindowedTable to specify the aggregations.
*/
OverWindowedTable window(OverWindow... overWindows);
+
+ /**
+ * Performs a field add operation. Similar to an SQL SELECT statement.
The field expressions
+ * can contain complex expressions, but can not be an aggregations.
Will report an expression if
+ * the added field name already exists.
+ *
+ * <p>Example:
+ * <pre>
+ * {@code
+ * tab.addColumns("a + 1 as a1, concat(b, 'sunny') as b1")
+ * }
+ * </pre>
+ */
+ Table addColumns(String fields);
+
+ /**
+ * Performs a field add operation. Similar to an SQL SELECT statement.
The field expressions
+ * can contain complex expressions, but can not be an aggregations.
Will report an expression if
+ * the added field name already exists.
+ *
+ * <p>Scala Example:
+ *
+ * <pre>
+ * {@code
+ * tab.addColumns('a + 1 as 'a1, concat('b, "sunny") as 'b1)
+ * }
+ * </pre>
+ */
+ Table addColumns(Expression... fields);
+
+ /**
+ * Performs a field add operation. Similar to an SQL SELECT statement.
The field expressions
+ * can contain complex expressions, but can not be an aggregations.
Existing fields will be
+ * replaced if {@code replaceIfExist} is true.
+ *
+ * <p>Example:
+ * <pre>
+ * {@code
+ * tab.addColumns(true, "a + 1 as a1, concat(b, 'sunny') as b1")
+ * }
+ * </pre>
+ */
+ Table addColumns(boolean replaceIfExist, String fields);
+
+ /**
+ * Performs a field add operation. Similar to an SQL SELECT statement.
The field expressions
+ * can contain complex expressions, but can not be an aggregations.
Existing fields will be
+ * replaced if {@code replaceIfExist} is true.
+ *
+ * <p>Scala Example:
+ * <pre>
+ * {@code
+ * tab.addColumns(true, 'a + 1 as 'a1, concat('b, "sunny") as 'b1)
+ * }
+ * </pre>
+ */
+ Table addColumns(boolean replaceIfExist, Expression... fields);
+
+ /**
+ * Performs a field rename operation. Similar to an field alias
statement. The field expressions
+ * should be an alias expressions, and only the existing fields can be
renamed.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * {@code
+ * tab.renameColumns("a as a1, b as b1")
+ * }
+ * </pre>
+ */
+ Table renameColumns(String fields);
+
+ /**
+ * Performs a field rename operation. Similar to an field alias
statement. The field expressions
+ * should be an alias expressions, and only the existing fields can be
renamed.
+ *
+ * <p>Scala Example:
+ *
+ * <pre>
+ * {@code
+ * tab.renameColumns('a as 'a1, 'b as 'b2)
+ * }
+ * </pre>
+ */
+ Table renameColumns(Expression... fields);
+
+ /**
+ * Performs a field drop operation. The field expressions
+ * should be an field reference expressions, and only the existing
fields can be drop.
+ *
+ * <p>Example:
+ *
+ * <pre>
+ * {@code
+ * tab.dropColumns("a, b")
+ * }
+ * </pre>
+ */
+ Table dropColumns(String fields);
+
+ /**
+ * Performs a field drop operation. The field expressions
+ * should be an field reference expressions, and only the existing
fields can be drop.
+ *
+ * <p>Scala Example:
+ * <pre>
+ * {@code
+ * tab.dropColumns('a, 'b)
+ * }
+ * </pre>
+ */
+ Table dropColumns(Expression... fields);
+
Review comment:
remove the empty line?
----------------------------------------------------------------
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