org.apache.calcite.sql.SqlOperandCountRange Java Examples
The following examples show how to use
org.apache.calcite.sql.SqlOperandCountRange.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OperandTypes.java From calcite with Apache License 2.0 | 6 votes |
public static SqlOperandTypeChecker variadic( final SqlOperandCountRange range) { return new SqlOperandTypeChecker() { public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { return range.isValidCount(callBinding.getOperandCount()); } public SqlOperandCountRange getOperandCountRange() { return range; } public String getAllowedSignatures(SqlOperator op, String opName) { return opName + "(...)"; } public boolean isOptional(int i) { return false; } public Consistency getConsistency() { return Consistency.NONE; } }; }
Example #2
Source File: OperandTypes.java From Bats with Apache License 2.0 | 6 votes |
public static SqlOperandTypeChecker variadic( final SqlOperandCountRange range) { return new SqlOperandTypeChecker() { public boolean checkOperandTypes( SqlCallBinding callBinding, boolean throwOnFailure) { return range.isValidCount(callBinding.getOperandCount()); } public SqlOperandCountRange getOperandCountRange() { return range; } public String getAllowedSignatures(SqlOperator op, String opName) { return opName + "(...)"; } public boolean isOptional(int i) { return false; } public Consistency getConsistency() { return Consistency.NONE; } }; }
Example #3
Source File: NumericExceptFirstOperandChecker.java From flink with Apache License 2.0 | 5 votes |
@Override public SqlOperandCountRange getOperandCountRange() { if (nOperands == -1) { return SqlOperandCountRanges.any(); } else { return SqlOperandCountRanges.of(nOperands); } }
Example #4
Source File: SameOperandTypeChecker.java From calcite with Apache License 2.0 | 5 votes |
public SqlOperandCountRange getOperandCountRange() { if (nOperands == -1) { return SqlOperandCountRanges.any(); } else { return SqlOperandCountRanges.of(nOperands); } }
Example #5
Source File: CompositeOperandTypeChecker.java From calcite with Apache License 2.0 | 5 votes |
/** * Package private. Use {@link OperandTypes#and}, * {@link OperandTypes#or}. */ CompositeOperandTypeChecker( Composition composition, ImmutableList<? extends SqlOperandTypeChecker> allowedRules, @Nullable String allowedSignatures, @Nullable SqlOperandCountRange range) { this.allowedRules = Objects.requireNonNull(allowedRules); this.composition = Objects.requireNonNull(composition); this.allowedSignatures = allowedSignatures; this.range = range; assert (range != null) == (composition == Composition.REPEAT); assert allowedRules.size() + (range == null ? 0 : 1) > 1; }
Example #6
Source File: CompositeOperandTypeChecker.java From calcite with Apache License 2.0 | 5 votes |
private int minMin(List<SqlOperandCountRange> ranges) { int min = Integer.MAX_VALUE; for (SqlOperandCountRange range : ranges) { min = Math.min(min, range.getMax()); } return min; }
Example #7
Source File: CompositeOperandTypeChecker.java From calcite with Apache License 2.0 | 5 votes |
private int maxMax(List<SqlOperandCountRange> ranges) { int max = Integer.MIN_VALUE; for (SqlOperandCountRange range : ranges) { if (range.getMax() < 0) { if (composition == Composition.OR) { return -1; } } else { max = Math.max(max, range.getMax()); } } return max; }
Example #8
Source File: FamilyOperandTypeChecker.java From calcite with Apache License 2.0 | 5 votes |
public SqlOperandCountRange getOperandCountRange() { final int max = families.size(); int min = max; while (min > 0 && optional.test(min - 1)) { --min; } return SqlOperandCountRanges.between(min, max); }
Example #9
Source File: SameOperandTypeChecker.java From Bats with Apache License 2.0 | 5 votes |
public SqlOperandCountRange getOperandCountRange() { if (nOperands == -1) { return SqlOperandCountRanges.any(); } else { return SqlOperandCountRanges.of(nOperands); } }
Example #10
Source File: OperandTypes.java From calcite with Apache License 2.0 | 5 votes |
/** * Creates a checker that passes if all of the rules pass for each operand, * using a given operand count strategy. */ public static SqlOperandTypeChecker repeat(SqlOperandCountRange range, SqlSingleOperandTypeChecker... rules) { return new CompositeOperandTypeChecker( CompositeOperandTypeChecker.Composition.REPEAT, ImmutableList.copyOf(rules), null, range); }
Example #11
Source File: CompositeOperandTypeChecker.java From Bats with Apache License 2.0 | 5 votes |
/** * Package private. Use {@link OperandTypes#and}, * {@link OperandTypes#or}. */ CompositeOperandTypeChecker( Composition composition, ImmutableList<? extends SqlOperandTypeChecker> allowedRules, String allowedSignatures, SqlOperandCountRange range) { this.allowedRules = Objects.requireNonNull(allowedRules); this.composition = Objects.requireNonNull(composition); this.allowedSignatures = allowedSignatures; this.range = range; assert (range != null) == (composition == Composition.REPEAT); assert allowedRules.size() + (range == null ? 0 : 1) > 1; }
Example #12
Source File: CompositeOperandTypeChecker.java From Bats with Apache License 2.0 | 5 votes |
private int minMin(List<SqlOperandCountRange> ranges) { int min = Integer.MAX_VALUE; for (SqlOperandCountRange range : ranges) { min = Math.min(min, range.getMax()); } return min; }
Example #13
Source File: CompositeOperandTypeChecker.java From Bats with Apache License 2.0 | 5 votes |
private int maxMax(List<SqlOperandCountRange> ranges) { int max = Integer.MIN_VALUE; for (SqlOperandCountRange range : ranges) { if (range.getMax() < 0) { if (composition == Composition.OR) { return -1; } } else { max = Math.max(max, range.getMax()); } } return max; }
Example #14
Source File: FamilyOperandTypeChecker.java From Bats with Apache License 2.0 | 5 votes |
public SqlOperandCountRange getOperandCountRange() { final int max = families.size(); int min = max; while (min > 0 && optional.test(min - 1)) { --min; } return SqlOperandCountRanges.between(min, max); }
Example #15
Source File: NumericExceptFirstOperandChecker.java From flink with Apache License 2.0 | 5 votes |
@Override public SqlOperandCountRange getOperandCountRange() { if (nOperands == -1) { return SqlOperandCountRanges.any(); } else { return SqlOperandCountRanges.of(nOperands); } }
Example #16
Source File: SqlLikeOperator.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.between(2, 3); }
Example #17
Source File: HiveUDFOperator.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return range; }
Example #18
Source File: SqlCaseOperator.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.any(); }
Example #19
Source File: SetopOperandTypeChecker.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(2); }
Example #20
Source File: SqlRegexpReplaceFunction.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.between(3, 6); }
Example #21
Source File: SqlSubstringFunction.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.between(2, 3); }
Example #22
Source File: SqlJsonDepthFunction.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(1); }
Example #23
Source File: SqlMultisetMemberOfOperator.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(2); }
Example #24
Source File: OperandTypes.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(1); }
Example #25
Source File: SqlDatePartFunction.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(1); }
Example #26
Source File: SqlCastFunction.java From calcite with Apache License 2.0 | 4 votes |
public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(2); }
Example #27
Source File: SqlJsonRemoveFunction.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.from(2); }
Example #28
Source File: SqlJsonObjectFunction.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.from(1); }
Example #29
Source File: SqlJsonPrettyFunction.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(1); }
Example #30
Source File: SqlItemOperator.java From calcite with Apache License 2.0 | 4 votes |
@Override public SqlOperandCountRange getOperandCountRange() { return SqlOperandCountRanges.of(2); }