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

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 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