Details
-
Improvement
-
Status: Open
-
Not a Priority
-
Resolution: Unresolved
-
None
-
None
Description
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):
class ColumnRange { IndexRange idx(Integer idx); ReferenceRange ref(String reference); } class IndexRange { IndexRange to(Integer idx); } class ReferenceRange { ReferenceRange to(String ref); }
We could also have implicit conversion from scala.Range to IndexRange.