use of org.apache.calcite.linq4j.Queryable in project calcite by apache.
the class Smalls method oneThreePlus.
private static QueryableTable oneThreePlus(String s) {
List<Integer> items;
// Then the engine calls a function with null arguments to get getRowType.
if (s == null) {
items = ImmutableList.of();
} else {
Integer latest = Integer.parseInt(s.substring(1, s.length() - 1));
items = ImmutableList.of(1, 3, latest);
}
final Enumerable<Integer> enumerable = Linq4j.asEnumerable(items);
return new AbstractQueryableTable(Integer.class) {
public <E> Queryable<E> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) {
// noinspection unchecked
return (Queryable<E>) enumerable.asQueryable();
}
public RelDataType getRowType(RelDataTypeFactory typeFactory) {
return typeFactory.builder().add("c", SqlTypeName.INTEGER).build();
}
};
}
Aggregations