本文整理汇总了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();
}
};
}
示例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);
}
示例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();
}
示例4: getReturnType
import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
return typeFactory.createJavaType((Class) combineFn.getOutputType().getType());
}
示例5: getReturnType
import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
@Override
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
return typeFactory.createJavaType(functionMethod.getReturnType());
}
示例6: getRowType
import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getRowType(RelDataTypeFactory typeFactory,
List<Object> arguments) {
return typeFactory.createJavaType(SqlAdvisorHint.class);
}
示例7: getReturnType
import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
return typeFactory.createJavaType(resultType);
}
示例8: getReturnType
import org.apache.calcite.rel.type.RelDataTypeFactory; //导入方法依赖的package包/类
public RelDataType getReturnType(RelDataTypeFactory typeFactory) {
return typeFactory.createJavaType(method.getReturnType());
}
示例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;
}
};
}