flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] sunjincheng121 commented on a change in pull request #8057: [FLINK-12028][table] Add `addColumns`,`renameColumns`, `dropColumns` …
Date Fri, 29 Mar 2019 10:17:34 GMT
sunjincheng121 commented on a change in pull request #8057: [FLINK-12028][table] Add `addColumns`,`renameColumns`,
`dropColumns` …
URL: https://github.com/apache/flink/pull/8057#discussion_r270349573
 
 

 ##########
 File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Table.java
 ##########
 @@ -879,4 +879,118 @@
 	 * @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 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);
+
+	/**
+	 * Performs a field add operation. Similar to an 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);
+
+	/**
+	 * Performs a field add operation. Similar to an SQL SELECT statement. The field expressions
+	 * can contain complex expressions, but can not contain aggregations. Existing fields will
be
+	 * replaced if {@code replaceIfExist} is true. If the added fields have duplicate field
name,
+	 * then the last one is valid.
+	 *
+	 * <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 contain aggregations. Existing fields will
be
+	 * replaced if {@code replaceIfExist} is true. If the added fields have duplicate field
name,
+	 * then the last one is valid.
+	 *
+	 * <p>Scala Example:
+	 * <pre>
+	 * {@code
+	 *   tab.addColumns(true, 'a + 1 as 'a1, concat('b, "sunny") as 'b1)
+	 * }
+	 * </pre>
+	 */
+	Table addColumns(boolean replaceIfExist, Expression... fields);
 
 Review comment:
   That's really difficult to choose,`addOrReplaceColumns == addColumns(true, fields)` they
are not equal. and I also think about this name, but I think in some platform want using `addColumns(variable(true
or false), fields).` replaceIfExist is a variable.  What do you think?

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


With regards,
Apache Git Services

Mime
View raw message