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:09:33 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_r270346847
 
 

 ##########
 File path: docs/dev/table/tableApi.md
 ##########
 @@ -188,7 +188,50 @@ Table result = orders.select("*");
 {% endhighlight %}
       </td>
     </tr>
-
+  <tr>
+          <td>
+            <strong>AddColumns</strong><br>
+            <span class="label label-primary">Batch</span> <span class="label
label-primary">Streaming</span>
+          </td>
+          <td>
+          <p>Performs a field add operation.</p>
+{% highlight java %}
+Table orders = tableEnv.scan("Orders");
+Table result = orders.addColumns("concat(c, 'sunny')");
+{% endhighlight %}
+            <p>You can also replace existing fields, the following example will replace
the 
+            existing `desc` field </p>
+{% highlight java %}
+Table result = orders.addColumns(true, "concat(c, 'sunny') as desc");
+{% endhighlight %}
+          </td>
+        </tr>
+         <tr>
+                  <td>
+                    <strong>DropColumns</strong><br>
+                    <span class="label label-primary">Batch</span> <span class="label
label-primary">Streaming</span>
+                  </td>
+                  <td>
+                  <p>Performs a field drop operation.</p>
+{% highlight java %}
+Table orders = tableEnv.scan("Orders");
+Table result = orders.dropColumns("b, c");
 
 Review comment:
   I think dropColumns only supports `FieldRefrence` or column operations, such as `dropColunns(columns(...))`
when FLINK-12029 is done.  And It will throw an exception If the column does not exist. The
columns that the user wants to delete are all known column names. If the user accidentally
writes the wrong column name but does not report an error, this will be a bit confusing, so
I chose strict verification if the column to be deleted does not exist, throw an exception
directly.  Is that make sense to you? 
   

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