org.apache.calcite.rel.type.RelDataTypeFactory.createMultisetType()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中org.apache.calcite.rel.type.RelDataTypeFactory.createMultisetType方法的一些代码示例,展示了RelDataTypeFactory.createMultisetType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RelDataTypeFactory.createMultisetType方法的具体详情如下:
包路径:org.apache.calcite.rel.type.RelDataTypeFactory
类名称:RelDataTypeFactory
方法名:createMultisetType

RelDataTypeFactory.createMultisetType介绍

[英]Creates a multiset type. Multisets are unordered collections of elements.
[中]创建多集类型。多集合是无序的元素集合。

代码示例

代码示例来源:origin: org.apache.calcite/calcite-core

public static RelDataType createMultisetType(
  RelDataTypeFactory typeFactory,
  RelDataType type,
  boolean nullable) {
 RelDataType ret = typeFactory.createMultisetType(type, -1);
 return typeFactory.createTypeWithNullability(ret, nullable);
}

代码示例来源:origin: Qihoo360/Quicksql

public static RelDataType createMultisetType(
  RelDataTypeFactory typeFactory,
  RelDataType type,
  boolean nullable) {
 RelDataType ret = typeFactory.createMultisetType(type, -1);
 return typeFactory.createTypeWithNullability(ret, nullable);
}

代码示例来源:origin: org.apache.kylin/atopcalcite

public static RelDataType createMultisetType(
    RelDataTypeFactory typeFactory,
    RelDataType type,
    boolean nullable) {
  RelDataType ret = typeFactory.createMultisetType(type, -1);
  return typeFactory.createTypeWithNullability(ret, nullable);
}

代码示例来源:origin: org.apache.calcite/calcite-core

protected RelDataType convertToStruct(RelDataType type) {
 // "MULTISET [<expr>, ...]" needs to be wrapped in a record if
 // <expr> has a scalar type.
 // For example, "MULTISET [8, 9]" has type
 // "RECORD(INTEGER EXPR$0 NOT NULL) NOT NULL MULTISET NOT NULL".
 final RelDataType componentType = type.getComponentType();
 if (componentType == null || componentType.isStruct()) {
  return type;
 }
 final RelDataTypeFactory typeFactory = validator.getTypeFactory();
 final RelDataType structType = toStruct(componentType, getNode());
 final RelDataType collectionType;
 switch (type.getSqlTypeName()) {
 case ARRAY:
  collectionType = typeFactory.createArrayType(structType, -1);
  break;
 case MULTISET:
  collectionType = typeFactory.createMultisetType(structType, -1);
  break;
 default:
  throw new AssertionError(type);
 }
 return typeFactory.createTypeWithNullability(collectionType,
   type.isNullable());
}

代码示例来源:origin: Qihoo360/Quicksql

protected RelDataType convertToStruct(RelDataType type) {
 // "MULTISET [<expr>, ...]" needs to be wrapped in a record if
 // <expr> has a scalar type.
 // For example, "MULTISET [8, 9]" has type
 // "RECORD(INTEGER EXPR$0 NOT NULL) NOT NULL MULTISET NOT NULL".
 final RelDataType componentType = type.getComponentType();
 if (componentType == null || componentType.isStruct()) {
  return type;
 }
 final RelDataTypeFactory typeFactory = validator.getTypeFactory();
 final RelDataType structType = toStruct(componentType, getNode());
 final RelDataType collectionType;
 switch (type.getSqlTypeName()) {
 case ARRAY:
  collectionType = typeFactory.createArrayType(structType, -1);
  break;
 case MULTISET:
  collectionType = typeFactory.createMultisetType(structType, -1);
  break;
 default:
  throw new AssertionError(type);
 }
 return typeFactory.createTypeWithNullability(collectionType,
   type.isNullable());
}

代码示例来源:origin: org.apache.kylin/atopcalcite

typeFactory.createMultisetType(
    flattenRecordType(
        typeFactory,

代码示例来源:origin: Qihoo360/Quicksql

type = typeFactory.createMultisetType(type, -1);
break;

代码示例来源:origin: org.apache.calcite/calcite-core

type = typeFactory.createMultisetType(type, -1);
break;

代码示例来源:origin: Qihoo360/Quicksql

typeFactory.createMultisetType(
  flattenRecordType(
    typeFactory,

代码示例来源:origin: org.apache.calcite/calcite-core

typeFactory.createMultisetType(
  flattenRecordType(
    typeFactory,

代码示例来源:origin: org.apache.calcite/calcite-core

componentType.isNullable());
boolean isn = type.isNullable();
type = typeFactory.createMultisetType(tt, -1);
type = typeFactory.createTypeWithNullability(type, isn);

代码示例来源:origin: Qihoo360/Quicksql

componentType.isNullable());
boolean isn = type.isNullable();
type = typeFactory.createMultisetType(tt, -1);
type = typeFactory.createTypeWithNullability(type, isn);

代码示例来源:origin: Qihoo360/Quicksql

@Test public void testTypeDump() {
 RelDataTypeFactory typeFactory =
   new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
 RelDataType t1 =
   typeFactory.builder()
     .add("f0", SqlTypeName.DECIMAL, 5, 2)
     .add("f1", SqlTypeName.VARCHAR, 10)
     .build();
 TestUtil.assertEqualsVerbose(
   TestUtil.fold(
     "f0 DECIMAL(5, 2) NOT NULL,",
     "f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL"),
   Util.toLinux(RelOptUtil.dumpType(t1) + "\n"));
 RelDataType t2 =
   typeFactory.builder()
     .add("f0", t1)
     .add("f1", typeFactory.createMultisetType(t1, -1))
     .build();
 TestUtil.assertEqualsVerbose(
   TestUtil.fold(
     "f0 RECORD (",
     "  f0 DECIMAL(5, 2) NOT NULL,",
     "  f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL,",
     "f1 RECORD (",
     "  f0 DECIMAL(5, 2) NOT NULL,",
     "  f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL MULTISET NOT NULL"),
   Util.toLinux(RelOptUtil.dumpType(t2) + "\n"));
}

代码示例来源:origin: org.apache.calcite/calcite-core

@Test public void testTypeDump() {
 RelDataTypeFactory typeFactory =
   new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
 RelDataType t1 =
   typeFactory.builder()
     .add("f0", SqlTypeName.DECIMAL, 5, 2)
     .add("f1", SqlTypeName.VARCHAR, 10)
     .build();
 TestUtil.assertEqualsVerbose(
   TestUtil.fold(
     "f0 DECIMAL(5, 2) NOT NULL,",
     "f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL"),
   Util.toLinux(RelOptUtil.dumpType(t1) + "\n"));
 RelDataType t2 =
   typeFactory.builder()
     .add("f0", t1)
     .add("f1", typeFactory.createMultisetType(t1, -1))
     .build();
 TestUtil.assertEqualsVerbose(
   TestUtil.fold(
     "f0 RECORD (",
     "  f0 DECIMAL(5, 2) NOT NULL,",
     "  f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL,",
     "f1 RECORD (",
     "  f0 DECIMAL(5, 2) NOT NULL,",
     "  f1 VARCHAR(10) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\" NOT NULL) NOT NULL MULTISET NOT NULL"),
   Util.toLinux(RelOptUtil.dumpType(t2) + "\n"));
}

相关文章