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


Java RelDataTypeFactory.createJavaType方法代码示例

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


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

示例1: multiplicationTable

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
/** A function that generates multiplication table of {@code ncol} columns x
 * {@code nrow} rows. */
public static QueryableTable multiplicationTable(final int ncol,
    final int nrow, Integer offset) {
  final int offs = offset == null ? 0 : offset;
  return new AbstractQueryableTable(Object[].class) {
    public RelDataType getRowType(RelDataTypeFactory typeFactory) {
      final RelDataTypeFactory.Builder builder = typeFactory.builder();
      builder.add("row_name", typeFactory.createJavaType(String.class));
      final RelDataType int_ = typeFactory.createJavaType(int.class);
      for (int i = 1; i <= ncol; i++) {
        builder.add("c" + i, int_);
      }
      return builder.build();
    }

    public Queryable<Object[]> asQueryable(QueryProvider queryProvider,
        SchemaPlus schema, String tableName) {
      final List<Object[]> table = new AbstractList<Object[]>() {
        @Override public Object[] get(int index) {
          Object[] cur = new Object[ncol + 1];
          cur[0] = "row " + index;
          for (int j = 1; j <= ncol; j++) {
            cur[j] = j * (index + 1) + offs;
          }
          return cur;
        }

        @Override public int size() {
          return nrow;
        }
      };
      return Linq4j.asEnumerable(table).asQueryable();
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:37,代码来源:Smalls.java

示例2: getRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
  int columnCount = columnNames.length;
  final List<Pair<String, RelDataType>> columnDesc =
      new ArrayList<>(columnCount);
  for (int i = 0; i < columnCount; i++) {
    final RelDataType colType = typeFactory
        .createJavaType(columnTypes[i]);
    columnDesc.add(Pair.of(columnNames[i], colType));
  }
  return typeFactory.createStructType(columnDesc);
}
 
开发者ID:apache,项目名称:calcite,代码行数:12,代码来源:TableInRootSchemaTest.java

示例3: PhysTable

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
PhysTable(RelOptCluster cluster) {
  super(cluster, cluster.traitSet().replace(PHYSICAL).replace(COLLATION));
  RelDataTypeFactory typeFactory = cluster.getTypeFactory();
  final RelDataType stringType = typeFactory.createJavaType(String.class);
  final RelDataType integerType = typeFactory.createJavaType(Integer.class);
  this.rowType = typeFactory.builder().add("s", stringType)
      .add("i", integerType).build();
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:TraitPropagationTest.java

示例4: getReturnType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
  return typeFactory.createJavaType((Class) combineFn.getOutputType().getType());
}
 
开发者ID:apache,项目名称:beam,代码行数:5,代码来源:UdafImpl.java

示例5: getReturnType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
    return typeFactory.createJavaType(functionMethod.getReturnType());
}
 
开发者ID:vlsi,项目名称:mat-calcite-plugin,代码行数:5,代码来源:SnapshotFunctions.java

示例6: getRowType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getRowType(RelDataTypeFactory typeFactory,
    List<Object> arguments) {
  return typeFactory.createJavaType(SqlAdvisorHint.class);
}
 
开发者ID:apache,项目名称:calcite,代码行数:5,代码来源:SqlAdvisorGetHintsFunction.java

示例7: getReturnType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
  return typeFactory.createJavaType(resultType);
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:AggregateFunctionImpl.java

示例8: getReturnType

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
  return typeFactory.createJavaType(method.getReturnType());
}
 
开发者ID:apache,项目名称:calcite,代码行数:4,代码来源:ScalarFunctionImpl.java

示例9: generateStrings

import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
/** A function that generates a table that generates a sequence of
 * {@link IntString} values. */
public static QueryableTable generateStrings(final Integer count) {
  return new AbstractQueryableTable(IntString.class) {
    public RelDataType getRowType(RelDataTypeFactory typeFactory) {
      return typeFactory.createJavaType(IntString.class);
    }

    public <T> Queryable<T> asQueryable(QueryProvider queryProvider,
        SchemaPlus schema, String tableName) {
      BaseQueryable<IntString> queryable =
          new BaseQueryable<IntString>(null, IntString.class, null) {
            public Enumerator<IntString> enumerator() {
              return new Enumerator<IntString>() {
                static final String Z = "abcdefghijklm";

                int i = 0;
                int curI;
                String curS;

                public IntString current() {
                  return new IntString(curI, curS);
                }

                public boolean moveNext() {
                  if (i < count) {
                    curI = i;
                    curS = Z.substring(0, i % Z.length());
                    ++i;
                    return true;
                  } else {
                    return false;
                  }
                }

                public void reset() {
                  i = 0;
                }

                public void close() {
                }
              };
            }
          };
      //noinspection unchecked
      return (Queryable<T>) queryable;
    }
  };
}
 
开发者ID:apache,项目名称:calcite,代码行数:50,代码来源:Smalls.java


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