dawidwys commented on a change in pull request #8057: [FLINK-12028][table] Add
`addColumns`,`renameColumns`, `dropColumns` …
URL: https://github.com/apache/flink/pull/8057#discussion_r270819194
##########
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);
+
+ /**
+ * Adds additional columns. Similar to a SQL SELECT statement. The
field expressions
+ * can contain complex expressions, but can not contain aggregations.
It will throw an exception
+ * if the added fields already exist.
+ *
+ * <p>Example:
+ * <pre>
+ * {@code
+ * tab.addColumns("a + 1 as a1, concat(b, 'sunny') as b1")
+ * }
+ * </pre>
+ */
+ Table addColumns(String fields);
+
+ /**
+ * Adds additional columns. Similar to a SQL SELECT statement. The
field expressions
+ * can contain complex expressions, but can not contain aggregations.
It will throw an exception
+ * if the added fields already exist.
+ *
+ * <p>Scala Example:
+ *
+ * <pre>
+ * {@code
+ * tab.addColumns('a + 1 as 'a1, concat('b, "sunny") as 'b1)
+ * }
+ * </pre>
+ */
+ Table addColumns(Expression... fields);
+
+ /**
+ * Adds additional columns. Similar to a SQL SELECT statement. The
field expressions
+ * can contain complex expressions, but can not contain aggregations.
Existing fields will be
+ * replaced if add columns name is the same as the existing column name.
Moreover, if the added
+ * fields have duplicate field name, then the last one is used.
+ *
+ * <p>Example:
+ * <pre>
+ * {@code
+ * tab.addOrReplaceColumns("a + 1 as a1, concat(b, 'sunny') as b1")
+ * }
+ * </pre>
+ */
+ Table addOrReplaceColumns(String fields);
+
+ /**
+ * Adds additional columns. Similar to a SQL SELECT statement. The
field expressions
+ * can contain complex expressions, but can not contain aggregations.
Existing fields will be
+ * replaced. If the added fields have duplicate field name, then the
last one is used.
+ *
+ * <p>Scala Example:
+ * <pre>
+ * {@code
+ * tab.addOrReplaceColumns('a + 1 as 'a1, concat('b, "sunny") as 'b1)
+ * }
+ * </pre>
+ */
+ Table addOrReplaceColumns(Expression... fields);
+
+ /**
+ * Renames existing columns. Similar to an field alias statement. The
field expressions
Review comment:
```suggestion
* Renames existing columns. Similar to a field alias statement. The
field expressions
```
----------------------------------------------------------------
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