You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dawid Wysakowicz (Jira)" <ji...@apache.org> on 2020/07/24 07:38:00 UTC

[jira] [Comment Edited] (FLINK-18699) Allow variables for column names in Scala Table API

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

Dawid Wysakowicz edited comment on FLINK-18699 at 7/24/20, 7:37 AM:
--------------------------------------------------------------------

Just to clarify. You are saying
{code}
val keyVar = ".."
val valueVar = ".."
tab.select($"$keyVar", $"$valueVar")
{code}
is inconvenient, right?

It is possible to import a java's Expressions.$ and achieve what you suggest already: 
{code}
import org.apache.flink.table.api.Expressions.$
val keyVar = ".."
val valueVar = ".."
tab.select($(keyVar), $(valueVar))
{code}
I do agree though if we want to recommend that approach we should expose this static method in scala's {{org.apache.flink.table.api}} package object.


was (Author: dawidwys):
Just to clarify. You are saying
{code}
val keyVar = ".."
val valueVar = ".."
tab.select($"$keyVar", $"$valueVar")
{code}
is inconvenient, right?

It is possible to import a java's Expressions.$ and achieve what you suggest: 
{code}
import org.apache.flink.table.api.Expressions.$
val keyVar = ".."
val valueVar = ".."
tab.select($(keyVar), $(valueVar))
{code}
I do agree though if we want to recommend that approach we should expose this static method in scala's {{org.apache.flink.table.api}} package object.

> Allow variables for column names in Scala Table API
> ---------------------------------------------------
>
>                 Key: FLINK-18699
>                 URL: https://issues.apache.org/jira/browse/FLINK-18699
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / API
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Major
>              Labels: pull-request-available
>
> User have reported that the Scala API lacks a way to reference columns via a name that is stored in a variable. String interpolation is inconvenient in this case:
> We should allow this also in Scala:
> {code}
> tab.select($(keyVar), $(valueVar))
> {code}



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