Java Code Examples for org.apache.calcite.sql.SqlKind

The following examples show how to use org.apache.calcite.sql.SqlKind. These examples are extracted from open source projects. 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 Project: calcite   Source File: ElasticsearchRules.java    License: Apache License 2.0 6 votes vote down vote up
@Override public String visitCall(RexCall call) {
  final String name = isItemCall(call);
  if (name != null) {
    return name;
  }

  final List<String> strings = visitList(call.operands);

  if (call.getKind() == SqlKind.CAST) {
    return call.getOperands().get(0).accept(this);
  }

  if (call.getOperator() == SqlStdOperatorTable.ITEM) {
    final RexNode op1 = call.getOperands().get(1);
    if (op1 instanceof RexLiteral && op1.getType().getSqlTypeName() == SqlTypeName.INTEGER) {
      return stripQuotes(strings.get(0)) + "[" + ((RexLiteral) op1).getValue2() + "]";
    }
  }
  throw new IllegalArgumentException("Translation of " + call
      + " is not supported by ElasticsearchProject");
}
 
Example 2
Source Project: calcite   Source File: RexSimplify.java    License: Apache License 2.0 6 votes vote down vote up
private static <C extends Comparable<C>> Range<C> range(SqlKind comparison,
    C c) {
  switch (comparison) {
  case EQUALS:
    return Range.singleton(c);
  case LESS_THAN:
    return Range.lessThan(c);
  case LESS_THAN_OR_EQUAL:
    return Range.atMost(c);
  case GREATER_THAN:
    return Range.greaterThan(c);
  case GREATER_THAN_OR_EQUAL:
    return Range.atLeast(c);
  default:
    throw new AssertionError();
  }
}
 
Example 3
Source Project: Bats   Source File: DateRangeRules.java    License: Apache License 2.0 6 votes vote down vote up
private Range<Calendar> extractRange(TimeUnitRange timeUnit, SqlKind comparison, Calendar c) {
    switch (comparison) {
    case EQUALS:
        return Range.closedOpen(round(c, timeUnit, true), round(c, timeUnit, false));
    case LESS_THAN:
        return Range.lessThan(round(c, timeUnit, true));
    case LESS_THAN_OR_EQUAL:
        return Range.lessThan(round(c, timeUnit, false));
    case GREATER_THAN:
        return Range.atLeast(round(c, timeUnit, false));
    case GREATER_THAN_OR_EQUAL:
        return Range.atLeast(round(c, timeUnit, true));
    default:
        throw new AssertionError(comparison);
    }
}
 
Example 4
Source Project: Bats   Source File: DateRangeRules.java    License: Apache License 2.0 6 votes vote down vote up
private RexNode compareFloorCeil(SqlKind comparison, RexNode operand, RexLiteral timeLiteral,
        TimeUnitRange timeUnit, boolean floor) {
    RangeSet<Calendar> rangeSet = operandRanges.get(operand);
    if (rangeSet == null) {
        rangeSet = ImmutableRangeSet.<Calendar> of().complement();
    }
    final RangeSet<Calendar> s2 = TreeRangeSet.create();
    final Calendar c = timestampValue(timeLiteral);
    final Range<Calendar> range = floor ? floorRange(timeUnit, comparison, c)
            : ceilRange(timeUnit, comparison, c);
    s2.add(range);
    // Intersect old range set with new.
    s2.removeAll(rangeSet.complement());
    operandRanges.put(operand, ImmutableRangeSet.copyOf(s2));
    if (range.isEmpty()) {
        return rexBuilder.makeLiteral(false);
    }
    return toRex(operand, range);
}
 
Example 5
Source Project: dremio-oss   Source File: PredicateAnalyzer.java    License: Apache License 2.0 6 votes vote down vote up
private QueryExpression postfix(RexCall call) {
  Preconditions.checkArgument(call.getKind() == SqlKind.IS_NULL || call.getKind() == SqlKind.IS_NOT_NULL);
  if (call.getOperands().size() != 1) {
    throw new PredicateAnalyzerException(format("Unsupported operator: [%s]", call));
  }
  Expression a = call.getOperands().get(0).accept(this);

  // Fields cannot be queried without being indexed
  final NamedFieldExpression fieldExpression = (NamedFieldExpression) a;
  if (fieldExpression.getAnnotation() != null && fieldExpression.getAnnotation().isNotIndexed()) {
    throw new PredicateAnalyzerException("Cannot handle " + call.getKind() + " expression for field not indexed, " + call);
  }

  // Elasticsearch does not want is null/is not null (exists query) for _id and _index, although it supports for all other metadata column
  isColumn(a, call, ElasticsearchConstants.ID, true);
  isColumn(a, call, ElasticsearchConstants.INDEX, true);
  QueryExpression operand = QueryExpression.create((TerminalExpression)a);
  return call.getKind() == SqlKind.IS_NOT_NULL ? operand.exists() : operand.notExists();
}
 
Example 6
Source Project: calcite   Source File: DruidJsonFilter.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
private static DruidJsonFilter toIsNullKindDruidFilter(RexNode rexNode, RelDataType rowType,
    DruidQuery druidQuery) {
  if (rexNode.getKind() != SqlKind.IS_NULL && rexNode.getKind() != SqlKind.IS_NOT_NULL) {
    throw new AssertionError(
        DruidQuery.format("Expecting IS_NULL or IS_NOT_NULL but got [%s]", rexNode.getKind()));
  }
  final RexCall rexCall = (RexCall) rexNode;
  final RexNode refNode = rexCall.getOperands().get(0);
  Pair<String, ExtractionFunction> druidColumn = DruidQuery
      .toDruidColumn(refNode, rowType, druidQuery);
  final String columnName = druidColumn.left;
  final ExtractionFunction extractionFunction = druidColumn.right;
  if (columnName == null) {
    return null;
  }
  if (rexNode.getKind() == SqlKind.IS_NOT_NULL) {
    return toNotDruidFilter(new JsonSelector(columnName, null, extractionFunction));
  }
  return new JsonSelector(columnName, null, extractionFunction);
}
 
Example 7
Source Project: calcite   Source File: RexSimplify.java    License: Apache License 2.0 6 votes vote down vote up
private static boolean isLowerBound(final RexNode e) {
  final List<RexNode> operands;
  switch (e.getKind()) {
  case LESS_THAN:
  case LESS_THAN_OR_EQUAL:
    operands = ((RexCall) e).getOperands();
    return RexUtil.isReferenceOrAccess(operands.get(1), true)
        && operands.get(0).isA(SqlKind.LITERAL);
  case GREATER_THAN:
  case GREATER_THAN_OR_EQUAL:
    operands = ((RexCall) e).getOperands();
    return RexUtil.isReferenceOrAccess(operands.get(0), true)
        && operands.get(1).isA(SqlKind.LITERAL);
  default:
    return false;
  }
}
 
Example 8
Source Project: calcite   Source File: RexImplicationChecker.java    License: Apache License 2.0 6 votes vote down vote up
private boolean isOppositeOp(SqlKind fKind, SqlKind sKind) {
  switch (sKind) {
  case GREATER_THAN:
  case GREATER_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.LESS_THAN)
        && !(fKind == SqlKind.LESS_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  case LESS_THAN:
  case LESS_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.GREATER_THAN)
        && !(fKind == SqlKind.GREATER_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  default:
    return false;
  }
  return true;
}
 
Example 9
Source Project: incubator-pinot   Source File: CalciteSqlCompilerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSelectAs() {
  PinotQuery pinotQuery = CalciteSqlParser.compileToPinotQuery(
      "select sum(A) as sum_A, count(B) as count_B  from vegetables where g IN (12, 13, 15.2, 17)");
  Function func = pinotQuery.getFilterExpression().getFunctionCall();
  Assert.assertEquals(func.getOperator(), SqlKind.IN.name());
  Assert.assertEquals(func.getOperands().get(0).getIdentifier().getName(), "g");
  Assert.assertEquals(func.getOperands().get(1).getLiteral().getLongValue(), 12L);
  Assert.assertEquals(func.getOperands().get(2).getLiteral().getLongValue(), 13L);
  Assert.assertEquals(func.getOperands().get(3).getLiteral().getDoubleValue(), 15.2);
  Assert.assertEquals(func.getOperands().get(4).getLiteral().getLongValue(), 17L);
  PinotQuery2BrokerRequestConverter converter = new PinotQuery2BrokerRequestConverter();
  BrokerRequest tempBrokerRequest = converter.convert(pinotQuery);
  Assert.assertEquals(tempBrokerRequest.getQuerySource().getTableName(), "vegetables");
  Assert.assertNull(tempBrokerRequest.getSelections());
  Assert.assertEquals(tempBrokerRequest.getAggregationsInfo().get(0).getAggregationType(), "SUM");
  Assert.assertEquals(tempBrokerRequest.getAggregationsInfo().get(1).getAggregationType(), "COUNT");
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getColumn(), "g");
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getValue().size(), 4);
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getValue().get(0), "12");
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getValue().get(1), "13");
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getValue().get(2), "15.2");
  Assert.assertEquals(tempBrokerRequest.getFilterQuery().getValue().get(3), "17");
}
 
Example 10
Source Project: flink   Source File: FlinkAggregateRemoveRule.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public boolean matches(RelOptRuleCall call) {
	final Aggregate aggregate = call.rel(0);
	final RelNode input = call.rel(1);
	if (aggregate.getGroupCount() == 0 || aggregate.indicator ||
			aggregate.getGroupType() != Aggregate.Group.SIMPLE) {
		return false;
	}
	for (AggregateCall aggCall : aggregate.getAggCallList()) {
		SqlKind aggCallKind = aggCall.getAggregation().getKind();
		// TODO supports more AggregateCalls
		boolean isAllowAggCall = aggCallKind == SqlKind.SUM ||
				aggCallKind == SqlKind.MIN ||
				aggCallKind == SqlKind.MAX ||
				aggCall.getAggregation() instanceof SqlAuxiliaryGroupAggFunction;
		if (!isAllowAggCall || aggCall.filterArg >= 0 || aggCall.getArgList().size() != 1) {
			return false;
		}
	}

	final RelMetadataQuery mq = call.getMetadataQuery();
	return SqlFunctions.isTrue(mq.areColumnsUnique(input, aggregate.getGroupSet()));
}
 
Example 11
Source Project: dremio-oss   Source File: PredicateAnalyzer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public RexNode visitCall(RexCall call) {
  if (call.getOperator().getKind() == SqlKind.NOT) {
    RexNode child = call.getOperands().get(0);
    if (child.getKind() == SqlKind.LIKE) {
      List<RexNode> operands = FluentIterable.from(((RexCall) child).getOperands()).transform(new Function<RexNode, RexNode>() {
        @Override
        public RexNode apply(RexNode rexNode) {
          return rexNode.accept(NotLikeConverter.this);
        }
      }).toList();
      return rexBuilder.makeCall(SqlStdOperatorTable.NOT_LIKE, operands);
    }
  }
  return super.visitCall(call);
}
 
Example 12
Source Project: Bats   Source File: RelStructuredTypeFlattener.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public RexNode visitCall(RexCall rexCall) {
    if (rexCall.isA(SqlKind.CAST)) {
        RexNode input = rexCall.getOperands().get(0).accept(this);
        RelDataType targetType = removeDistinct(rexCall.getType());
        return rexBuilder.makeCast(targetType, input);
    }
    if (!rexCall.isA(SqlKind.COMPARISON)) {
        return super.visitCall(rexCall);
    }
    RexNode lhs = rexCall.getOperands().get(0);
    if (!lhs.getType().isStruct()) {
        // NOTE jvs 9-Mar-2005: Calls like IS NULL operate
        // on the representative null indicator. Since it comes
        // first, we don't have to do any special translation.
        return super.visitCall(rexCall);
    }

    // NOTE jvs 22-Mar-2005: Likewise, the null indicator takes
    // care of comparison null semantics without any special casing.
    return flattenComparison(rexBuilder, rexCall.getOperator(), rexCall.getOperands());
}
 
Example 13
Source Project: Bats   Source File: SqlStdOperatorTable.java    License: Apache License 2.0 6 votes vote down vote up
/** Returns the operator for {@code ALL comparisonKind}. */
public static SqlQuantifyOperator all(SqlKind comparisonKind) {
  switch (comparisonKind) {
  case EQUALS:
    return ALL_EQ;
  case NOT_EQUALS:
    return ALL_NE;
  case LESS_THAN:
    return ALL_LT;
  case LESS_THAN_OR_EQUAL:
    return ALL_LE;
  case GREATER_THAN:
    return ALL_GT;
  case GREATER_THAN_OR_EQUAL:
    return ALL_GE;
  default:
    throw new AssertionError(comparisonKind);
  }
}
 
Example 14
Source Project: calcite   Source File: GeodeRules.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Check if the node is a supported predicate (primary field condition).
 *
 * @param node       Condition node to check
 * @param fieldNames Names of all columns in the table
 * @return True if the node represents an equality predicate on a primary key
 */
private boolean isEqualityOnKey(RexNode node, List<String> fieldNames) {

  if (isBooleanColumnReference(node, fieldNames)) {
    return true;
  }

  if (!SqlKind.COMPARISON.contains(node.getKind())) {
    return false;
  }

  RexCall call = (RexCall) node;
  final RexNode left = call.operands.get(0);
  final RexNode right = call.operands.get(1);

  if (checkConditionContainsInputRefOrLiterals(left, right, fieldNames)) {
    return true;
  }
  return checkConditionContainsInputRefOrLiterals(right, left, fieldNames);

}
 
Example 15
Source Project: Bats   Source File: DrillMergeProjectRule.java    License: Apache License 2.0 6 votes vote down vote up
public static List<RexNode> simplifyCast(List<RexNode> projectExprs) {
  final List<RexNode> list = new ArrayList<>();
  for (RexNode rex: projectExprs) {
    if (rex.getKind() == SqlKind.CAST) {
      RexNode operand = ((RexCall) rex).getOperands().get(0);
      while (operand.getKind() == SqlKind.CAST
          && operand.getType().equals(rex.getType())) {
        rex = operand;
        operand = ((RexCall) rex).getOperands().get(0);
      }

    }
    list.add(rex);
  }
  return list;
}
 
Example 16
Source Project: kareldb   Source File: FilterableTable.java    License: Apache License 2.0 6 votes vote down vote up
private Comparable[] findKeyFieldAccess(DataContext root, RexNode filter, SqlKind operator) {
    int[] keyIndices = getKeyIndices();
    List<String> keyFields = getRelDef().getKeyFields();
    Comparable[] keyValues = new Comparable[keyIndices.length];
    for (int i = 0; i < keyIndices.length; i++) {
        int keyIndex = keyIndices[i];
        String keyField = keyFields.get(i);
        ColumnType type = ColumnType.of(getRowType().getField(keyField, true, false).getType().getSqlTypeName());
        List<Comparable> values = scanFilterForKeyField(root, filter, keyIndex, operator, type);
        if (values.isEmpty()) {
            return null;
        }
        keyValues[i] = values.get(0);
    }
    return keyValues;
}
 
Example 17
Source Project: calcite   Source File: MssqlSqlDialect.java    License: Apache License 2.0 6 votes vote down vote up
@Override public void unparseSqlDatetimeArithmetic(SqlWriter writer,
    SqlCall call, SqlKind sqlKind, int leftPrec, int rightPrec) {

  final SqlWriter.Frame frame = writer.startFunCall("DATEADD");
  SqlNode operand = call.operand(1);
  if (operand instanceof SqlIntervalLiteral) {
    //There is no DATESUB method available, so change the sign.
    unparseSqlIntervalLiteralMssql(
        writer, (SqlIntervalLiteral) operand, sqlKind == SqlKind.MINUS ? -1 : 1);
  } else {
    operand.unparse(writer, leftPrec, rightPrec);
  }
  writer.sep(",", true);

  call.operand(0).unparse(writer, leftPrec, rightPrec);
  writer.endList(frame);
}
 
Example 18
Source Project: calcite   Source File: RexImplicationChecker.java    License: Apache License 2.0 6 votes vote down vote up
private boolean isEquivalentOp(SqlKind fKind, SqlKind sKind) {
  switch (sKind) {
  case GREATER_THAN:
  case GREATER_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.GREATER_THAN)
        && !(fKind == SqlKind.GREATER_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  case LESS_THAN:
  case LESS_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.LESS_THAN)
        && !(fKind == SqlKind.LESS_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  default:
    return false;
  }

  return true;
}
 
Example 19
Source Project: Bats   Source File: RexImplicationChecker.java    License: Apache License 2.0 6 votes vote down vote up
private boolean isEquivalentOp(SqlKind fKind, SqlKind sKind) {
  switch (sKind) {
  case GREATER_THAN:
  case GREATER_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.GREATER_THAN)
        && !(fKind == SqlKind.GREATER_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  case LESS_THAN:
  case LESS_THAN_OR_EQUAL:
    if (!(fKind == SqlKind.LESS_THAN)
        && !(fKind == SqlKind.LESS_THAN_OR_EQUAL)) {
      return false;
    }
    break;
  default:
    return false;
  }

  return true;
}
 
Example 20
Source Project: flink   Source File: SqlToOperationConverter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This is the main entrance for executing all kinds of DDL/DML {@code SqlNode}s, different
 * SqlNode will have it's implementation in the #convert(type) method whose 'type' argument
 * is subclass of {@code SqlNode}.
 *
 * @param flinkPlanner     FlinkPlannerImpl to convert sql node to rel node
 * @param sqlNode          SqlNode to execute on
 */
public static Operation convert(FlinkPlannerImpl flinkPlanner, SqlNode sqlNode) {
	// validate the query
	final SqlNode validated = flinkPlanner.validate(sqlNode);
	SqlToOperationConverter converter = new SqlToOperationConverter(flinkPlanner);
	if (validated instanceof SqlCreateTable) {
		return converter.convertCreateTable((SqlCreateTable) validated);
	} if (validated instanceof SqlDropTable) {
		return converter.convertDropTable((SqlDropTable) validated);
	} else if (validated instanceof RichSqlInsert) {
		return converter.convertSqlInsert((RichSqlInsert) validated);
	} else if (validated.getKind().belongsTo(SqlKind.QUERY)) {
		return converter.convertSqlQuery(validated);
	} else {
		throw new TableException("Unsupported node type "
			+ validated.getClass().getSimpleName());
	}
}
 
Example 21
Source Project: calcite   Source File: SetopNamespace.java    License: Apache License 2.0 6 votes vote down vote up
public RelDataType validateImpl(RelDataType targetRowType) {
  switch (call.getKind()) {
  case UNION:
  case INTERSECT:
  case EXCEPT:
    final SqlValidatorScope scope = validator.scopes.get(call);
    for (SqlNode operand : call.getOperandList()) {
      if (!(operand.isA(SqlKind.QUERY))) {
        throw validator.newValidationError(operand,
            RESOURCE.needQueryOp(operand.toString()));
      }
      validator.validateQuery(operand, scope, targetRowType);
    }
    return call.getOperator().deriveType(
        validator,
        scope,
        call);
  default:
    throw new AssertionError("Not a query: " + call.getKind());
  }
}
 
Example 22
Source Project: calcite   Source File: EnumerableTraitsUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Determine whether there is mapping between project input and output fields.
 * Bail out if sort relies on non-trivial expressions.
 */
private static boolean isCollationOnTrivialExpr(
    List<RexNode> projects, RelDataTypeFactory typeFactory,
    Mappings.TargetMapping map, RelFieldCollation fc, boolean passDown) {
  final int index = fc.getFieldIndex();
  int target = map.getTargetOpt(index);
  if (target < 0) {
    return false;
  }

  final RexNode node = passDown ? projects.get(index) : projects.get(target);
  if (node.isA(SqlKind.CAST)) {
    // Check whether it is a monotonic preserving cast
    final RexCall cast = (RexCall) node;
    RelFieldCollation newFieldCollation = Objects.requireNonNull(RexUtil.apply(map, fc));
    final RexCallBinding binding =
        RexCallBinding.create(typeFactory, cast,
            ImmutableList.of(RelCollations.of(newFieldCollation)));
    if (cast.getOperator().getMonotonicity(binding)
        == SqlMonotonicity.NOT_MONOTONIC) {
      return false;
    }
  }

  return true;
}
 
Example 23
Source Project: calcite   Source File: RexSimplify.java    License: Apache License 2.0 6 votes vote down vote up
private static boolean isUpperBound(final RexNode e) {
  final List<RexNode> operands;
  switch (e.getKind()) {
  case LESS_THAN:
  case LESS_THAN_OR_EQUAL:
    operands = ((RexCall) e).getOperands();
    return RexUtil.isReferenceOrAccess(operands.get(0), true)
        && operands.get(1).isA(SqlKind.LITERAL);
  case GREATER_THAN:
  case GREATER_THAN_OR_EQUAL:
    operands = ((RexCall) e).getOperands();
    return RexUtil.isReferenceOrAccess(operands.get(1), true)
        && operands.get(0).isA(SqlKind.LITERAL);
  default:
    return false;
  }
}
 
Example 24
Source Project: Bats   Source File: RelRoot.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a simple RelRoot. */
public static RelRoot of(RelNode rel, RelDataType rowType, SqlKind kind) {
  final ImmutableIntList refs =
      ImmutableIntList.identity(rowType.getFieldCount());
  final List<String> names = rowType.getFieldNames();
  return new RelRoot(rel, rowType, kind, Pair.zip(refs, names),
      RelCollations.EMPTY);
}
 
Example 25
Source Project: calcite   Source File: SqlLeadLagAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
public SqlLeadLagAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      RETURN_TYPE,
      null,
      OPERAND_TYPES,
      SqlFunctionCategory.NUMERIC,
      false,
      true,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.LEAD
      || kind == SqlKind.LAG);
}
 
Example 26
Source Project: marble   Source File: HiveSqlFunction.java    License: Apache License 2.0 5 votes vote down vote up
public HiveSqlFunction(SqlIdentifier sqlIdentifier, SqlKind kind,
    SqlReturnTypeInference returnTypeInference,
    SqlFunctionCategory category) {
  super(Util.last(sqlIdentifier.names), sqlIdentifier, kind,
      returnTypeInference, null, ArgChecker.INSTANCE,
      null, category);
}
 
Example 27
Source Project: calcite   Source File: RelMdPredicates.java    License: Apache License 2.0 5 votes vote down vote up
@Override public Void visitCall(RexCall call) {
  if (call.getOperator().getKind() == SqlKind.EQUALS) {
    int lPos = pos(call.getOperands().get(0));
    int rPos = pos(call.getOperands().get(1));
    if (lPos != -1 && rPos != -1) {
      markAsEquivalent(lPos, rPos);
      equalityPredicates.add(call);
    }
  }
  return null;
}
 
Example 28
Source Project: Bats   Source File: SqlAnyValueAggFunction.java    License: Apache License 2.0 5 votes vote down vote up
/** Creates a SqlAnyValueAggFunction. */
public SqlAnyValueAggFunction(SqlKind kind) {
  super(kind.name(),
      null,
      kind,
      ReturnTypes.ARG0_NULLABLE_IF_EMPTY,
      null,
      OperandTypes.ANY,
      SqlFunctionCategory.SYSTEM,
      false,
      false,
      Optionality.FORBIDDEN);
  Preconditions.checkArgument(kind == SqlKind.ANY_VALUE);
}
 
Example 29
Source Project: flink   Source File: SqlValidatorImpl.java    License: Apache License 2.0 5 votes vote down vote up
private boolean shouldCheckForRollUp(SqlNode from) {
	if (from != null) {
		SqlKind kind = stripAs(from).getKind();
		return kind != SqlKind.VALUES && kind != SqlKind.SELECT;
	}
	return false;
}
 
Example 30
Source Project: calcite   Source File: SqlColumnListConstructor.java    License: Apache License 2.0 5 votes vote down vote up
public SqlColumnListConstructor() {
  super(
      "COLUMN_LIST",
      SqlKind.COLUMN_LIST, MDX_PRECEDENCE,
      false,
      ReturnTypes.COLUMN_LIST,
      null,
      OperandTypes.ANY);
}