congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
OperandTypes.family
Code IndexAdd Tabnine to your IDE (free)

How to use
family
method
in
org.apache.calcite.sql.type.OperandTypes

Best Java code snippets using org.apache.calcite.sql.type.OperandTypes.family (Showing top 20 results out of 315)

origin: apache/incubator-druid

 public SqlFunction build()
 {
  return new SqlFunction(
    name,
    kind,
    Preconditions.checkNotNull(returnTypeInference, "returnTypeInference"),
    null,
    OperandTypes.family(
      Preconditions.checkNotNull(operandTypes, "operandTypes"),
      i -> i + 1 > requiredOperands
    ),
    functionCategory
  );
 }
}
origin: apache/incubator-druid

 QuantileSqlAggFunction()
 {
  super(
    NAME,
    null,
    SqlKind.OTHER_FUNCTION,
    ReturnTypes.explicit(SqlTypeName.DOUBLE),
    null,
    OperandTypes.or(
      OperandTypes.and(
        OperandTypes.sequence(SIGNATURE1, OperandTypes.ANY, OperandTypes.LITERAL),
        OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.NUMERIC)
      ),
      OperandTypes.and(
        OperandTypes.sequence(SIGNATURE2, OperandTypes.ANY, OperandTypes.LITERAL, OperandTypes.LITERAL),
        OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.NUMERIC, SqlTypeFamily.EXACT_NUMERIC)
      )
    ),
    SqlFunctionCategory.NUMERIC,
    false,
    false
  );
 }
}
origin: apache/hive

private static CalciteUDFInfo getUDFInfo(String hiveUdfName,
  ImmutableList<RelDataType> calciteArgTypes, RelDataType calciteRetType) {
 CalciteUDFInfo udfInfo = new CalciteUDFInfo();
 udfInfo.udfName = hiveUdfName;
 udfInfo.returnTypeInference = ReturnTypes.explicit(calciteRetType);
 udfInfo.operandTypeInference = InferTypes.explicit(calciteArgTypes);
 ImmutableList.Builder<SqlTypeFamily> typeFamilyBuilder = new ImmutableList.Builder<SqlTypeFamily>();
 for (RelDataType at : calciteArgTypes) {
  typeFamilyBuilder.add(Util.first(at.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
 }
 udfInfo.operandTypeChecker = OperandTypes.family(typeFamilyBuilder.build());
 return udfInfo;
}
origin: apache/kylin

SqlAggFunction createCustomAggFunction(String funcName, RelDataType returnType, Class<?> customAggFuncClz) {
  RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
  SqlIdentifier sqlIdentifier = new SqlIdentifier(funcName, new SqlParserPos(1, 1));
  AggregateFunction aggFunction = AggregateFunctionImpl.create(customAggFuncClz);
  List<RelDataType> argTypes = new ArrayList<RelDataType>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<SqlTypeFamily>();
  for (FunctionParameter o : aggFunction.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType),
      InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction, false, false,
      typeFactory);
}
origin: apache/drill

private static CalciteUDFInfo getUDFInfo(String hiveUdfName,
  ImmutableList<RelDataType> calciteArgTypes, RelDataType calciteRetType) {
 CalciteUDFInfo udfInfo = new CalciteUDFInfo();
 udfInfo.udfName = hiveUdfName;
 udfInfo.returnTypeInference = ReturnTypes.explicit(calciteRetType);
 udfInfo.operandTypeInference = InferTypes.explicit(calciteArgTypes);
 ImmutableList.Builder<SqlTypeFamily> typeFamilyBuilder = new ImmutableList.Builder<SqlTypeFamily>();
 for (RelDataType at : calciteArgTypes) {
  typeFamilyBuilder.add(Util.first(at.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
 }
 udfInfo.operandTypeChecker = OperandTypes.family(typeFamilyBuilder.build());
 return udfInfo;
}
origin: Qihoo360/Quicksql

 SqlTimestampDiffFunction() {
  super("TIMESTAMPDIFF", SqlKind.TIMESTAMP_DIFF,
    RETURN_TYPE_INFERENCE, null,
    OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.DATETIME,
      SqlTypeFamily.DATETIME),
    SqlFunctionCategory.TIMEDATE);
 }
}
origin: Qihoo360/Quicksql

 /** Creates a SqlTimestampAddFunction. */
 SqlTimestampAddFunction() {
  super("TIMESTAMPADD", SqlKind.TIMESTAMP_ADD, RETURN_TYPE_INFERENCE, null,
    OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
      SqlTypeFamily.DATETIME),
    SqlFunctionCategory.TIMEDATE);
 }
}
origin: org.apache.calcite/calcite-core

 /** Creates a SqlTimestampAddFunction. */
 SqlTimestampAddFunction() {
  super("TIMESTAMPADD", SqlKind.TIMESTAMP_ADD, RETURN_TYPE_INFERENCE, null,
    OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
      SqlTypeFamily.DATETIME),
    SqlFunctionCategory.TIMEDATE);
 }
}
origin: org.apache.calcite/calcite-core

 SqlTimestampDiffFunction() {
  super("TIMESTAMPDIFF", SqlKind.TIMESTAMP_DIFF,
    RETURN_TYPE_INFERENCE, null,
    OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.DATETIME,
      SqlTypeFamily.DATETIME),
    SqlFunctionCategory.TIMEDATE);
 }
}
origin: Qihoo360/Quicksql

/**
 * Creates a checker that passes if each operand is a member of a
 * corresponding family.
 */
public static FamilyOperandTypeChecker family(List<SqlTypeFamily> families) {
 return family(families, i -> false);
}
origin: org.apache.calcite/calcite-core

/**
 * Creates a checker that passes if each operand is a member of a
 * corresponding family.
 */
public static FamilyOperandTypeChecker family(List<SqlTypeFamily> families) {
 return family(families, i -> false);
}
origin: org.apache.calcite/calcite-core

public SqlJsonArrayAggAggFunction(String name,
  SqlJsonConstructorNullClause nullClause) {
 super(name, null, SqlKind.JSON_ARRAYAGG, ReturnTypes.VARCHAR_2000, null,
   OperandTypes.family(SqlTypeFamily.ANY), SqlFunctionCategory.SYSTEM,
   false, false, Optionality.FORBIDDEN);
 this.nullClause = Objects.requireNonNull(nullClause);
}
origin: org.apache.calcite/calcite-core

/** Creates a SqlJsonObjectAggAggFunction. */
public SqlJsonObjectAggAggFunction(String name,
  SqlJsonConstructorNullClause nullClause) {
 super(name, null, SqlKind.JSON_OBJECTAGG, ReturnTypes.VARCHAR_2000, null,
   OperandTypes.family(SqlTypeFamily.CHARACTER, SqlTypeFamily.ANY),
   SqlFunctionCategory.SYSTEM, false, false, Optionality.FORBIDDEN);
 this.nullClause = Objects.requireNonNull(nullClause);
}
origin: org.apache.calcite/calcite-core

public SqlJsonQueryFunction() {
 super("JSON_QUERY", SqlKind.OTHER_FUNCTION,
   ReturnTypes.cascade(ReturnTypes.VARCHAR_2000,
     SqlTypeTransforms.FORCE_NULLABLE),
   null,
   OperandTypes.family(SqlTypeFamily.ANY,
     SqlTypeFamily.ANY, SqlTypeFamily.ANY, SqlTypeFamily.ANY),
   SqlFunctionCategory.SYSTEM);
}
origin: org.apache.calcite/calcite-core

public SqlJsonApiCommonSyntaxOperator() {
 super("JSON_API_COMMON_SYNTAX", SqlKind.JSON_API_COMMON_SYNTAX, 100, true,
   ReturnTypes.explicit(SqlTypeName.ANY), null,
   OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.STRING));
}
origin: Qihoo360/Quicksql

private SqlSingleOperandTypeChecker getChecker(RelDataType operandType) {
 switch (operandType.getSqlTypeName()) {
 case ARRAY:
  return OperandTypes.family(SqlTypeFamily.INTEGER);
 case MAP:
  return OperandTypes.family(
    operandType.getKeyType().getSqlTypeName().getFamily());
 case ANY:
 case DYNAMIC_STAR:
  return OperandTypes.or(
    OperandTypes.family(SqlTypeFamily.INTEGER),
    OperandTypes.family(SqlTypeFamily.CHARACTER));
 default:
  throw new AssertionError(operandType.getSqlTypeName());
 }
}
origin: Qihoo360/Quicksql

private SqlSingleOperandTypeChecker getChecker(RelDataType operandType) {
 switch (operandType.getSqlTypeName()) {
 case ROW:
  return OperandTypes.family(SqlTypeFamily.STRING);
 default:
  throw new AssertionError(operandType.getSqlTypeName());
 }
}
origin: org.apache.calcite/calcite-core

private SqlSingleOperandTypeChecker getChecker(RelDataType operandType) {
 switch (operandType.getSqlTypeName()) {
 case ROW:
  return OperandTypes.family(SqlTypeFamily.STRING);
 default:
  throw new AssertionError(operandType.getSqlTypeName());
 }
}
origin: org.apache.kylin/kylin-query

SqlAggFunction createCustomAggFunction(String funcName, RelDataType returnType, Class<?> customAggFuncClz) {
  RelDataTypeFactory typeFactory = getCluster().getTypeFactory();
  SqlIdentifier sqlIdentifier = new SqlIdentifier(funcName, new SqlParserPos(1, 1));
  AggregateFunction aggFunction = AggregateFunctionImpl.create(customAggFuncClz);
  List<RelDataType> argTypes = new ArrayList<RelDataType>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<SqlTypeFamily>();
  for (FunctionParameter o : aggFunction.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  return new SqlUserDefinedAggFunction(sqlIdentifier, ReturnTypes.explicit(returnType),
      InferTypes.explicit(argTypes), OperandTypes.family(typeFamilies), aggFunction, false, false,
      typeFactory);
}
origin: com.facebook.presto.hive/hive-apache

private static CalciteUDFInfo getUDFInfo(String hiveUdfName,
  ImmutableList<RelDataType> calciteArgTypes, RelDataType calciteRetType) {
 CalciteUDFInfo udfInfo = new CalciteUDFInfo();
 udfInfo.udfName = hiveUdfName;
 udfInfo.returnTypeInference = ReturnTypes.explicit(calciteRetType);
 udfInfo.operandTypeInference = InferTypes.explicit(calciteArgTypes);
 ImmutableList.Builder<SqlTypeFamily> typeFamilyBuilder = new ImmutableList.Builder<SqlTypeFamily>();
 for (RelDataType at : calciteArgTypes) {
  typeFamilyBuilder.add(Util.first(at.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
 }
 udfInfo.operandTypeChecker = OperandTypes.family(typeFamilyBuilder.build());
 udfInfo.argTypes = ImmutableList.<RelDataType> copyOf(calciteArgTypes);
 udfInfo.retType = calciteRetType;
 return udfInfo;
}
org.apache.calcite.sql.typeOperandTypesfamily

Javadoc

Creates a checker that passes if each operand is a member of a corresponding family.

Popular methods of OperandTypes

  • sequence
    Creates an operand checker from a sequence of single-operand checkers.
  • or
    Creates a single-operand checker that passes if any one of the rules passes.
  • and
    Creates a single-operand checker that passes if all of the rules pass.
  • repeat
    Creates a checker that passes if all of the rules pass for each operand, using a given operand count

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now