Java Code Examples for org.apache.calcite.linq4j.Enumerable#select()
The following examples show how to use
org.apache.calcite.linq4j.Enumerable#select() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Smalls.java From calcite with Apache License 2.0 | 6 votes |
/** * A function that adds a number to the first column of input cursor */ public static QueryableTable processCursor(final int offset, final Enumerable<Object[]> a) { return new AbstractQueryableTable(Object[].class) { public RelDataType getRowType(RelDataTypeFactory typeFactory) { return typeFactory.builder() .add("result", SqlTypeName.INTEGER) .build(); } public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) { final Enumerable<Integer> enumerable = a.select(a0 -> offset + ((Integer) a0[0])); //noinspection unchecked return (Queryable) enumerable.asQueryable(); } }; }
Example 2
Source File: MycatReflectiveSchema.java From Mycat2 with GNU General Public License v3.0 | 5 votes |
public Enumerable<Object[]> scan(DataContext root) { Enumerable enumerable = this.enumerable.get(); if (elementType == Object[].class) { //noinspection unchecked return enumerable; } else { //noinspection unchecked return enumerable.select(new FieldSelector((Class) elementType)); } }
Example 3
Source File: Enumerables.java From calcite with Apache License 2.0 | 4 votes |
/** Converts an enumerable over singleton arrays into the enumerable of their * first elements. */ public static <E> Enumerable<E> slice0(Enumerable<E[]> enumerable) { //noinspection unchecked return enumerable.select(elements -> elements[0]); }
Example 4
Source File: Enumerables.java From calcite with Apache License 2.0 | 4 votes |
/** Converts an {@link Enumerable} over object arrays into an * {@link Enumerable} over {@link Row} objects. */ public static Enumerable<Row> toRow(final Enumerable<Object[]> enumerable) { return enumerable.select((Function1<Object[], Row>) Row::asCopy); }