twalthr commented on a change in pull request #8017: [hotfix][table]
Introduced UnresolvedFieldReference & ResolvedFieldReference expressions
URL: https://github.com/apache/flink/pull/8017#discussion_r267284080
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/expressions/FieldReferenceExpression.java
##########
@@ -25,40 +25,53 @@
import java.util.Collections;
import java.util.List;
import java.util.Objects;
-import java.util.Optional;
/**
- * A reference to a field. The reference might be typed or not.
- *
- * <p>Whether a field reference has a type depends on the current planning
phase. Usually, field
- * references used in the API have not been resolved/validated and, thus, have
no type attached.
- * References that come out of the optimizer are likely to be resolved and
typed.
+ * A reference to a field in an input. The reference contains:
+ * <ul>
+ * <li>type</li>
+ * <li>index of an input the field belongs to</li>
+ * <li>index of a field within the corresponding input</li>
+ * </ul>
*/
@PublicEvolving
public final class FieldReferenceExpression implements Expression {
private final String name;
- private final Optional<TypeInformation<?>> resultType;
+ private final TypeInformation<?> resultType;
- public FieldReferenceExpression(String name) {
- this.name = Preconditions.checkNotNull(name);
- this.resultType = Optional.empty();
- }
+ private final int inputIndex;
+
+ private final int fieldIndex;
- public FieldReferenceExpression(String name, TypeInformation<?>
resultType) {
+ public FieldReferenceExpression(
+ String name,
+ TypeInformation<?> resultType,
+ int inputIndex,
+ int fieldIndex) {
this.name = Preconditions.checkNotNull(name);
- this.resultType = Optional.of(resultType);
+ this.resultType = Preconditions.checkNotNull(resultType);
+ this.inputIndex = inputIndex;
Review comment:
Add check for negative values?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services