当前位置: 首页>>代码示例>>Java>>正文


Java OperandTypes.family方法代码示例

本文整理汇总了Java中org.apache.calcite.sql.type.OperandTypes.family方法的典型用法代码示例。如果您正苦于以下问题:Java OperandTypes.family方法的具体用法?Java OperandTypes.family怎么用?Java OperandTypes.family使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.calcite.sql.type.OperandTypes的用法示例。


在下文中一共展示了OperandTypes.family方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChecker

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
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());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:17,代码来源:SqlItemOperator.java

示例2: SqlTimestampAddFunction

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
/** Creates a SqlTimestampAddFunction. */
SqlTimestampAddFunction() {
    super("TIMESTAMPADD", SqlKind.TIMESTAMP_ADD, RETURN_TYPE_INFERENCE, null,
          OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
                              SqlTypeFamily.TIMESTAMP),
          SqlFunctionCategory.TIMEDATE);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:SqlTimestampAddFunction.java

示例3: createCustomAggFunction

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:OLAPAggregateRel.java

示例4: SqlTimestampAddFunction

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
/** Creates a SqlTimestampAddFunction. */
SqlTimestampAddFunction() {
  super("TIMESTAMPADD", SqlKind.TIMESTAMP_ADD, RETURN_TYPE_INFERENCE, null,
      OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.INTEGER,
          SqlTypeFamily.DATETIME),
      SqlFunctionCategory.TIMEDATE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:8,代码来源:SqlTimestampAddFunction.java

示例5: SqlTimestampDiffFunction

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
/** Creates a SqlTimestampDiffFunction. */
SqlTimestampDiffFunction() {
  super("TIMESTAMPDIFF", SqlKind.TIMESTAMP_DIFF,
      ReturnTypes.INTEGER_NULLABLE, null,
      OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.DATETIME,
          SqlTypeFamily.DATETIME),
      SqlFunctionCategory.TIMEDATE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SqlTimestampDiffFunction.java

示例6: getChecker

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
private SqlSingleOperandTypeChecker getChecker(RelDataType operandType) {
  switch (operandType.getSqlTypeName()) {
  case ROW:
    return OperandTypes.family(SqlTypeFamily.STRING);
  default:
    throw new AssertionError(operandType.getSqlTypeName());
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:SqlDotOperator.java

示例7: toOp

import org.apache.calcite.sql.type.OperandTypes; //导入方法依赖的package包/类
/** Converts a function to a {@link org.apache.calcite.sql.SqlOperator}.
 *
 * <p>The {@code typeFactory} argument is technical debt; see [CALCITE-2082]
 * Remove RelDataTypeFactory argument from SqlUserDefinedAggFunction
 * constructor. */
private static SqlOperator toOp(RelDataTypeFactory typeFactory,
    SqlIdentifier name, final Function function) {
  List<RelDataType> argTypes = new ArrayList<>();
  List<SqlTypeFamily> typeFamilies = new ArrayList<>();
  for (FunctionParameter o : function.getParameters()) {
    final RelDataType type = o.getType(typeFactory);
    argTypes.add(type);
    typeFamilies.add(
        Util.first(type.getSqlTypeName().getFamily(), SqlTypeFamily.ANY));
  }
  final Predicate<Integer> optional =
      new PredicateImpl<Integer>() {
        public boolean test(Integer input) {
          return function.getParameters().get(input).isOptional();
        }
      };
  final FamilyOperandTypeChecker typeChecker =
      OperandTypes.family(typeFamilies, optional);
  final List<RelDataType> paramTypes = toSql(typeFactory, argTypes);
  if (function instanceof ScalarFunction) {
    return new SqlUserDefinedFunction(name, infer((ScalarFunction) function),
        InferTypes.explicit(argTypes), typeChecker, paramTypes, function);
  } else if (function instanceof AggregateFunction) {
    return new SqlUserDefinedAggFunction(name,
        infer((AggregateFunction) function), InferTypes.explicit(argTypes),
        typeChecker, (AggregateFunction) function, false, false, typeFactory);
  } else if (function instanceof TableMacro) {
    return new SqlUserDefinedTableMacro(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableMacro) function);
  } else if (function instanceof TableFunction) {
    return new SqlUserDefinedTableFunction(name, ReturnTypes.CURSOR,
        InferTypes.explicit(argTypes), typeChecker, paramTypes,
        (TableFunction) function);
  } else {
    throw new AssertionError("unknown function type " + function);
  }
}
 
开发者ID:apache,项目名称:calcite,代码行数:44,代码来源:CalciteCatalogReader.java


注:本文中的org.apache.calcite.sql.type.OperandTypes.family方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。