Java Code Examples for org.apache.calcite.sql.type.OperandTypes#ANY_ANY

The following examples show how to use org.apache.calcite.sql.type.OperandTypes#ANY_ANY . 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: ClassRowTypeCache.java    From mat-calcite-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public RexNode apply(RexBuilderContext context) {
	RelOptCluster cluster = context.getCluster();
	RelDataTypeFactory typeFactory = cluster.getTypeFactory();
	final SqlFunction UDF =
			new SqlUserDefinedFunction(
					new SqlIdentifier("RESOLVE_SIMPLE", SqlParserPos.ZERO),
					ReturnTypes.explicit(typeFactory.createJavaType(Object.class)),
					null,
					OperandTypes.ANY_ANY,
					ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false),
							typeFactory.createJavaType(int.class)),
					ScalarFunctionImpl.create(IObjectMethods.class, "resolveSimpleValue"));
	RexBuilder b = context.getBuilder();
	RexNode rexNode = b.makeCall(UDF, context.getIObject(), b.makeLiteral(name));
	return b.makeCast(dataType, rexNode);
}
 
Example 2
Source File: ClassRowTypeCache.java    From mat-calcite-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public RexNode apply(RexBuilderContext context) {
	RelOptCluster cluster = context.getCluster();
	RelDataTypeFactory typeFactory = cluster.getTypeFactory();
	final SqlFunction UDF =
			new SqlUserDefinedFunction(
					new SqlIdentifier("RESOLVE_REFERENCE", SqlParserPos.ZERO),
					ReturnTypes.explicit(typeFactory.createJavaType(HeapReference.class)),
					null,
					OperandTypes.ANY_ANY,
					ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false),
							typeFactory.createJavaType(String.class)),
					ScalarFunctionImpl.create(IObjectMethods.class, "resolveReferenceValue"));
	RexBuilder b = context.getBuilder();
	return b.makeCall(UDF, context.getIObject(), b.makeLiteral(name));
}
 
Example 3
Source File: RexBuilderContext.java    From mat-calcite-plugin with Apache License 2.0 6 votes vote down vote up
public RexNode getIObject() {
    if (object == null) {
        RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
        RexBuilder b = getBuilder();
        final SqlFunction GET_IOBJECT =
                new SqlUserDefinedFunction(
                        new SqlIdentifier("GET_IOBJECT", SqlParserPos.ZERO),
                        ReturnTypes.explicit(typeFactory.createTypeWithNullability(typeFactory.createJavaType(IObject.class), false)),
                        null,
                        OperandTypes.ANY_ANY,
                        ImmutableList.of(typeFactory.createTypeWithNullability(typeFactory.createJavaType(ISnapshot.class), false),
                                typeFactory.createJavaType(int.class)),
                        ScalarFunctionImpl.create(ISnapshotMethods.class, "getIObject"));
        object = b.makeCall(GET_IOBJECT, getSnapshot(), getIObjectId());
    }
    return object;
}
 
Example 4
Source File: SqlAsOperator.java    From Bats with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an AS operator.
 */
public SqlAsOperator() {
  this(
      "AS",
      SqlKind.AS,
      20,
      true,
      ReturnTypes.ARG0,
      InferTypes.RETURN_TYPE,
      OperandTypes.ANY_ANY);
}
 
Example 5
Source File: SqlOverOperator.java    From Bats with Apache License 2.0 5 votes vote down vote up
public SqlOverOperator() {
  super(
      "OVER",
      SqlKind.OVER,
      20,
      true,
      ReturnTypes.ARG0_FORCE_NULLABLE,
      null,
      OperandTypes.ANY_ANY);
}
 
Example 6
Source File: SqlAsOperator.java    From calcite with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an AS operator.
 */
public SqlAsOperator() {
  this(
      "AS",
      SqlKind.AS,
      20,
      true,
      ReturnTypes.ARG0,
      InferTypes.RETURN_TYPE,
      OperandTypes.ANY_ANY);
}
 
Example 7
Source File: SqlOverOperator.java    From calcite with Apache License 2.0 5 votes vote down vote up
public SqlOverOperator() {
  super(
      "OVER",
      SqlKind.OVER,
      20,
      true,
      ReturnTypes.ARG0_FORCE_NULLABLE,
      null,
      OperandTypes.ANY_ANY);
}
 
Example 8
Source File: SqlFilterOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlFilterOperator() {
  super("FILTER", SqlKind.FILTER, 2, true, ReturnTypes.ARG0_FORCE_NULLABLE,
      null, OperandTypes.ANY_ANY);
}
 
Example 9
Source File: SqlArgumentAssignmentOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
SqlArgumentAssignmentOperator() {
  super("=>", SqlKind.ARGUMENT_ASSIGNMENT, 20, true, ReturnTypes.ARG0,
      InferTypes.RETURN_TYPE, OperandTypes.ANY_ANY);
}
 
Example 10
Source File: SqlWithinGroupOperator.java    From Bats with Apache License 2.0 4 votes vote down vote up
public SqlWithinGroupOperator() {
  super("WITHIN GROUP", SqlKind.WITHIN_GROUP, 100, true, ReturnTypes.ARG0,
      null, OperandTypes.ANY_ANY);
}
 
Example 11
Source File: SqlFilterOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlFilterOperator() {
  super("FILTER", SqlKind.FILTER, 20, true, ReturnTypes.ARG0_FORCE_NULLABLE,
      null, OperandTypes.ANY_ANY);
}
 
Example 12
Source File: SqlArgumentAssignmentOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
SqlArgumentAssignmentOperator() {
  super("=>", SqlKind.ARGUMENT_ASSIGNMENT, 20, true, ReturnTypes.ARG0,
      InferTypes.RETURN_TYPE, OperandTypes.ANY_ANY);
}
 
Example 13
Source File: SqlWithinGroupOperator.java    From calcite with Apache License 2.0 4 votes vote down vote up
public SqlWithinGroupOperator() {
  super("WITHIN GROUP", SqlKind.WITHIN_GROUP, 100, true, ReturnTypes.ARG0,
      null, OperandTypes.ANY_ANY);
}