本文整理汇总了Java中org.apache.calcite.sql.SqlKind.NOT_EQUALS属性的典型用法代码示例。如果您正苦于以下问题:Java SqlKind.NOT_EQUALS属性的具体用法?Java SqlKind.NOT_EQUALS怎么用?Java SqlKind.NOT_EQUALS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.calcite.sql.SqlKind
的用法示例。
在下文中一共展示了SqlKind.NOT_EQUALS属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simplifyUsingPredicates
private <C extends Comparable<C>> RexNode simplifyUsingPredicates(RexNode e,
Class<C> clazz) {
final Comparison comparison = Comparison.of(e);
// Check for comparison with null values
if (comparison == null
|| comparison.kind == SqlKind.NOT_EQUALS
|| comparison.literal.getValue() == null) {
return e;
}
final C v0 = comparison.literal.getValueAs(clazz);
final Range<C> range = range(comparison.kind, v0);
final Range<C> range2 =
residue(comparison.ref, range, predicates.pulledUpPredicates,
clazz);
if (range2 == null) {
// Term is impossible to satisfy given these predicates
return rexBuilder.makeLiteral(false);
} else if (range2.equals(range)) {
// no change
return e;
} else if (range2.equals(Range.all())) {
// Term is always satisfied given these predicates
return rexBuilder.makeLiteral(true);
} else if (range2.lowerEndpoint().equals(range2.upperEndpoint())) {
if (range2.lowerBoundType() == BoundType.OPEN
|| range2.upperBoundType() == BoundType.OPEN) {
// range is a point, but does not include its endpoint, therefore is
// effectively empty
return rexBuilder.makeLiteral(false);
}
// range is now a point; it's worth simplifying
return rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, comparison.ref,
rexBuilder.makeLiteral(range2.lowerEndpoint(),
comparison.literal.getType(), comparison.literal.getTypeName()));
} else {
// range has been reduced but it's not worth simplifying
return e;
}
}
示例2: flattenComparison
private RexNode flattenComparison(
RexBuilder rexBuilder,
SqlOperator op,
List<RexNode> exprs) {
final List<Pair<RexNode, String>> flattenedExps = Lists.newArrayList();
flattenProjections(this, exprs, null, "", flattenedExps);
int n = flattenedExps.size() / 2;
boolean negate = false;
if (op.getKind() == SqlKind.NOT_EQUALS) {
negate = true;
op = SqlStdOperatorTable.EQUALS;
}
if ((n > 1) && op.getKind() != SqlKind.EQUALS) {
throw Util.needToImplement(
"inequality comparison for row types");
}
RexNode conjunction = null;
for (int i = 0; i < n; ++i) {
RexNode comparison =
rexBuilder.makeCall(
op,
flattenedExps.get(i).left,
flattenedExps.get(i + n).left);
if (conjunction == null) {
conjunction = comparison;
} else {
conjunction =
rexBuilder.makeCall(
SqlStdOperatorTable.AND,
conjunction,
comparison);
}
}
if (negate) {
return rexBuilder.makeCall(
SqlStdOperatorTable.NOT,
conjunction);
} else {
return conjunction;
}
}