Search in sources :

Example 11 with AbstractEnumerable

use of org.apache.calcite.linq4j.AbstractEnumerable in project calcite by apache.

the class CsvScannableTable method scan.

public Enumerable<Object[]> scan(DataContext root) {
    final int[] fields = CsvEnumerator.identityList(fieldTypes.size());
    final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
    return new AbstractEnumerable<Object[]>() {

        public Enumerator<Object[]> enumerator() {
            return new CsvEnumerator<>(source, cancelFlag, false, null, new CsvEnumerator.ArrayRowConverter(fieldTypes, fields));
        }
    };
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AbstractEnumerable(org.apache.calcite.linq4j.AbstractEnumerable)

Example 12 with AbstractEnumerable

use of org.apache.calcite.linq4j.AbstractEnumerable in project calcite by apache.

the class CsvStreamScannableTable method scan.

public Enumerable<Object[]> scan(DataContext root) {
    final int[] fields = CsvEnumerator.identityList(fieldTypes.size());
    final AtomicBoolean cancelFlag = DataContext.Variable.CANCEL_FLAG.get(root);
    return new AbstractEnumerable<Object[]>() {

        public Enumerator<Object[]> enumerator() {
            return new CsvEnumerator<>(source, cancelFlag, true, null, new CsvEnumerator.ArrayRowConverter(fieldTypes, fields, true));
        }
    };
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AbstractEnumerable(org.apache.calcite.linq4j.AbstractEnumerable)

Aggregations

AbstractEnumerable (org.apache.calcite.linq4j.AbstractEnumerable)12 RelDataTypeFactory (org.apache.calcite.rel.type.RelDataTypeFactory)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 DataContext (org.apache.calcite.DataContext)3 Enumerator (org.apache.calcite.linq4j.Enumerator)3 ScannableTable (org.apache.calcite.schema.ScannableTable)3 Schema (org.apache.calcite.schema.Schema)3 IOException (java.io.IOException)2 Map (java.util.Map)2 CalciteConnectionConfig (org.apache.calcite.config.CalciteConnectionConfig)2 Enumerable (org.apache.calcite.linq4j.Enumerable)2 RelDataType (org.apache.calcite.rel.type.RelDataType)2 RelProtoDataType (org.apache.calcite.rel.type.RelProtoDataType)2 SqlCall (org.apache.calcite.sql.SqlCall)2 SqlNode (org.apache.calcite.sql.SqlNode)2 SqlTypeName (org.apache.calcite.sql.type.SqlTypeName)2 ResultSet (com.datastax.driver.core.ResultSet)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 MongoCollection (com.mongodb.client.MongoCollection)1 BufferedReader (java.io.BufferedReader)1