Class FlinkRexBuilder
RexBuilder. See the overridden methods for more explanation.-
Field Summary
Fields inherited from class org.apache.calcite.rex.RexBuilder
GET_OPERATOR, typeFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.calcite.rex.RexNodemakeFieldAccess(org.apache.calcite.rex.RexNode expr, int i) Compared to the original method we adjust the nullability of the nested column based on the nullability of the enclosing type.org.apache.calcite.rex.RexNodemakeFieldAccess(org.apache.calcite.rex.RexNode expr, String fieldName, boolean caseSensitive) Compared to the original method we adjust the nullability of the nested column based on the nullability of the enclosing type.org.apache.calcite.rex.RexNodeConvert the conditions into theINand fix [CALCITE-4888]: UnexpectedRexNodewhen callRelBuilder.in(org.apache.calcite.rex.RexNode, org.apache.calcite.rex.RexNode...)to create anINpredicate with a list of varchar literals which have different length inRexBuilder.makeIn(org.apache.calcite.rex.RexNode, java.util.List<? extends org.apache.calcite.rex.RexNode>).org.apache.calcite.rex.RexLiteralmakeZeroLiteral(org.apache.calcite.rel.type.RelDataType type) Creates a literal of the default value for the given type.Methods inherited from class org.apache.calcite.rex.RexBuilder
addAggCall, addAggCall, addAggCall, baseUnit, constantNull, copy, decodeIntervalOrDecimal, deriveReturnType, encodeIntervalOrDecimal, ensureType, getOpTab, getTypeFactory, identityProjects, makeAbstractCast, makeApproxLiteral, makeApproxLiteral, makeBetween, makeBigintLiteral, makeBinaryLiteral, makeCall, makeCall, makeCall, makeCast, makeCast, makeCharLiteral, makeCorrel, makeDateLiteral, makeDateLiteral, makeDynamicParam, makeExactLiteral, makeExactLiteral, makeFlag, makeInputRef, makeInputRef, makeIntervalLiteral, makeIntervalLiteral, makeLiteral, makeLiteral, makeLiteral, makeLiteral, makeLiteral, makeLiteral, makeLocalRef, makeNewInvocation, makeNotNull, makeNullLiteral, makeNullLiteral, makeNullLiteral, makeOver, makeOver, makePatternFieldRef, makePreciseStringLiteral, makePreciseStringLiteral, makeRangeReference, makeRangeReference, makeReinterpretCast, makeSearchArgumentLiteral, makeTimeLiteral, makeTimeLiteral, makeTimestampLiteral, makeTimestampLiteral, makeTimestampWithLocalTimeZoneLiteral, makeTimeWithLocalTimeZoneLiteral, makeWindow, matchNullability, multiplyDivide
-
Constructor Details
-
FlinkRexBuilder
public FlinkRexBuilder(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory)
-
-
Method Details
-
makeFieldAccess
public org.apache.calcite.rex.RexNode makeFieldAccess(org.apache.calcite.rex.RexNode expr, String fieldName, boolean caseSensitive) Compared to the original method we adjust the nullability of the nested column based on the nullability of the enclosing type.If the fields type is NOT NULL, but the enclosing ROW is nullable we still can produce nulls.
- Overrides:
makeFieldAccessin classorg.apache.calcite.rex.RexBuilder
-
makeFieldAccess
public org.apache.calcite.rex.RexNode makeFieldAccess(org.apache.calcite.rex.RexNode expr, int i) Compared to the original method we adjust the nullability of the nested column based on the nullability of the enclosing type.If the fields type is NOT NULL, but the enclosing ROW is nullable we still can produce nulls.
- Overrides:
makeFieldAccessin classorg.apache.calcite.rex.RexBuilder
-
makeZeroLiteral
public org.apache.calcite.rex.RexLiteral makeZeroLiteral(org.apache.calcite.rel.type.RelDataType type) Creates a literal of the default value for the given type.This value is:
- 0 for numeric types;
- FALSE for BOOLEAN;
- The epoch for TIMESTAMP and DATE;
- Midnight for TIME;
- The empty string for string types (CHAR, BINARY, VARCHAR, VARBINARY).
Uses '1970-01-01 00:00:00'(epoch 0 second) as zero value for TIMESTAMP_LTZ, the zero value '0000-00-00 00:00:00' in Calcite is an invalid time whose month and day is invalid, we workaround here. Stop overriding once CALCITE-4555 fixed.
- Overrides:
makeZeroLiteralin classorg.apache.calcite.rex.RexBuilder- Parameters:
type- Type- Returns:
- Simple literal, or cast simple literal
-
makeIn
public org.apache.calcite.rex.RexNode makeIn(org.apache.calcite.rex.RexNode arg, List<? extends org.apache.calcite.rex.RexNode> ranges) Convert the conditions into theINand fix [CALCITE-4888]: UnexpectedRexNodewhen callRelBuilder.in(org.apache.calcite.rex.RexNode, org.apache.calcite.rex.RexNode...)to create anINpredicate with a list of varchar literals which have different length inRexBuilder.makeIn(org.apache.calcite.rex.RexNode, java.util.List<? extends org.apache.calcite.rex.RexNode>).The bug is because the origin implementation doesn't take
FlinkTypeSystem.shouldConvertRaggedUnionTypesToVarying()into consideration. When this is true, the behaviour should not padding char. Please see https://issues.apache.org/jira/browse/CALCITE-4590 and https://issues.apache.org/jira/browse/CALCITE-2321. Please refer toorg.apache.calcite.rex.RexSimplify.RexSargBuilder#getTypefor the correct behaviour.Once CALCITE-4888 is fixed, this method (and related methods) should be removed.
- Overrides:
makeInin classorg.apache.calcite.rex.RexBuilder
-