You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Timo Walther (Jira)" <ji...@apache.org> on 2020/10/22 13:35:00 UTC

[jira] [Commented] (FLINK-19746) Why delete support for "as" function

    [ https://issues.apache.org/jira/browse/FLINK-19746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17219011#comment-17219011 ] 

Timo Walther commented on FLINK-19746:
--------------------------------------

[~appleyuchi]
 {{tEnv.createTemporaryView("Orders", orderA,$("user,product,amount"));}}

is not the correct way of declaring aliasing, instead it should be

{{tEnv.createTemporaryView("Orders", orderA, $("user"), $("product"), $("amount"));}}

because the dollar sign is always used for accessing exactly one field. In the past people were confusing the string with SQL, which is wrong. We recently decided to clearly separate SQL from Java strings.

For the future, this part of the API will be further simplified. As we will implement FLIP-136:
 [https://cwiki.apache.org/confluence/display/FLINK/FLIP-136%3A++Improve+interoperability+between+DataStream+and+Table+API]

Then the alias will not be necessary anymore and the fields will be derived automatically.

> Why delete support for "as" function
> ------------------------------------
>
>                 Key: FLINK-19746
>                 URL: https://issues.apache.org/jira/browse/FLINK-19746
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 1.11.0
>            Reporter: appleyuchi
>            Priority: Major
>
> I know the solution for my following question,so I'm not  asking for support to debug [this code|https://paste.ubuntu.com/p/Mw5tJSmDCs/]
> when I use the function "as("x","y","z")." in my code,
> two available *preparation code* for "create table":
> ||relevant code||running log||Deprecated?||
> |tEnv.registerDataStream("Orders", orderA,"user,product,amount");|ok|YES|
> |tEnv.createTemporaryView("Orders", orderA,$("user,product,amount"));|user,product,amount is not a field of type PojoType<Order, fields = [amount: Integer, product: String, user: Long]>. Expected: amount, product, user}|NO|
> Question:
> why *the support for "as" is REMOVED* when the *newest officially recommended createTemporaryView* is used?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)