Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/5132#discussion_r159770375
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/TableEnvironment.scala
---
@@ -791,92 +824,109 @@ abstract class TableEnvironment(val config:
TableConfig) {
* Returns field names and field positions for a given
[[TypeInformation]] and [[Array]] of
* [[Expression]]. It does not handle time attributes but considers
them in indices.
*
+ * @param isReferenceByPosition schema mode see
[[isReferenceByPosition()]]
* @param inputType The [[TypeInformation]] against which the
[[Expression]]s are evaluated.
* @param exprs The expressions that define the field names.
* @tparam A The type of the TypeInformation.
* @return A tuple of two arrays holding the field names and
corresponding field positions.
*/
- protected[flink] def getFieldInfo[A](
+ protected def getFieldInfo[A](
+ isReferenceByPosition: Boolean,
inputType: TypeInformation[A],
exprs: Array[Expression])
: (Array[String], Array[Int]) = {
TableEnvironment.validateType(inputType)
+ def referenceByName(name: String, ct: CompositeType[_]): Option[(Int,
String)] = {
--- End diff --
if we change the return type to `Option[Int]`, we can use it also for the
`Alias` cases.
For example for `PojoTypeInfo`:
```
case (UnresolvedFieldReference(name: String)) =>
referenceByName(name, p).map((_, name))
case Alias(UnresolvedFieldReference(origName), name: String, _) =>
referenceByName(origName, p).map((_, name))
```
---