[
https://issues.apache.org/jira/browse/FLINK-12298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16824901#comment-16824901
]
Dawid Wysakowicz commented on FLINK-12298:
------------------------------------------
# I agree other api methods have similar problems. I don't think it is an
argument to introduce more problems, though.
# I think from user perspective, as I mentioned a few times before, I see the
column expressions similar to fieldReference rather than function. I really
think it should be used like that:
{code}
select(call(concat, withColumns(idx(1).to(10)), field("a")))
{code}
In other words I agree from the internal perspective it is a call that still
will accept Expression. From user perspective it should be a typesafe function
that accepts arguments in a type safe manner.
# I think we should not postpone it, as this is a new API that we can design
properly upfront. Once released it is gonna be hard to change it. I also see no
interference with Java API. Moreover I think the suggested approach even
simplifies the column expressions for the JAVA DSL.
> Make column functions accept custom Range class rather than Expression
> ----------------------------------------------------------------------
>
> Key: FLINK-12298
> URL: https://issues.apache.org/jira/browse/FLINK-12298
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Reporter: Dawid Wysakowicz
> Priority: Major
>
> I would suggest to rework the column functions to a more typesafe approach
> with custom {{Range}} class. Right now {{withColumns}} accepts array of
> Expressions. We have
> {{org.apache.flink.table.api.scala.ImplicitExpressionOperations#to}} method,
> but also we have implicit conversion from {{scala.Range}} to Expression
> range. This already introduces ambiguity, as it is unclear what will be the
> end product of expression like {{1 to 9}}. This approach defers the checking
> of the types of expressions to expressions resolution phase.
> I would suggest to make
> {{org.apache.flink.table.api.scala.withColumns#apply}} always accept e.g.
> {{ColumnRange}} that could always accept only {{Integer}} or {{String}}
> instead of Expressions. Such class could look like (this is just a very rough
> outline):
> {code}
> class ColumnRange {
> IndexRange idx(Integer idx);
> ReferenceRange ref(String reference);
> }
> class IndexRange {
> IndexRange to(Integer idx);
> }
> class ReferenceRange {
> ReferenceRange to(String ref);
> }
> {code}
> We could also have implicit conversion from {{scala.Range}} to {{IndexRange}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)