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_r270342816
 
 

 ##########
 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");
+{% endhighlight %}
+                  </td>
+                </tr>
+         <tr>
+                  <td>
+                    <strong>RenameColumns</strong><br>
+                    <span class="label label-primary">Batch</span> <span 
class="label label-primary">Streaming</span>
+                  </td>
+                  <td>
+                  <p>Performs a field rename operation.</p>
+{% highlight java %}
+Table orders = tableEnv.scan("Orders");
+Table result = orders.renameColumns("b as b2, c as c2");
 
 Review comment:
   That good point, I had thought this case, I think we should throw the 
exception if the renamed `name` already exists.  In common case, the user wants 
to rename a meaningful `name` for their business. but not want replace exist 
one, if user want replace exist one, the will drop the exist by dropColumns, 
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:
[email protected]


With regards,
Apache Git Services

Reply via email to