java.lang.Object
com.gpudb.GPUdbSqlIterator<T>
All Implemented Interfaces:
public class GPUdbSqlIterator<T extends Record> extends Object implements Iterable<T>, AutoCloseable
Kinetica API class for iterating over records returned by executing an SQL query. This class accepts a
GPUdb instance and an SQL statement to facilitate iteration over the records returned by the query. SQL options can be passed as a Map. The ‘batchSize’ for the number of records returned is set to a default of ‘10000’, which can be modified using the parameter ‘batchSize’ to the constructor. Example usage, passing a database connection and a SQL statement to the GPUdbSqlIterator:
Copyright (c) 2023 Kinetica DB Inc.
try (GPUdbSqlIterator<Record> iterator = new GPUdbSqlIterator<>(gpudb, sql);)
for (Record record : iterator)
System.out.println(record);
catch (Exception e)
System.err.println(“Error in iteration: ” + e.getMessage());
Constructor Summary
ConstructorsConstructorDescriptionGPUdbSqlIterator(GPUdb db, String sql) Constructor forGPUdbSqlIteratorGPUdbSqlIterator(GPUdb db, String sql, int batchSize) Constructor forGPUdbSqlIteratorConstructor forGPUdbSqlIteratorConstructor forGPUdbSqlIterator
Constructor Details
GPUdbSqlIterator
Constructor forGPUdbSqlIteratorGPUdbSqlIterator
Constructor forGPUdbSqlIteratorParameters:db- - aGPUdbinstancesql- - the SQL statement to executebatchSize- - the number of records to fetchThrows:GPUdbSqlIterator
Constructor forGPUdbSqlIteratorParameters:db- - aGPUdbinstancesql- - the SQL statement to executesqlOptions- - the SQL options to be passed inThrows:See Also:GPUdbSqlIterator
public GPUdbSqlIterator(GPUdb db, String sql, int batchSize, Map<String, String> sqlOptions) throws GPUdbException Constructor forGPUdbSqlIteratorParameters:db- - aGPUdbinstancesql- - the SQL statement to executebatchSize- - the number of records to fetchsqlOptions- - the SQL options to be passed inThrows:See Also:
Method Details
size
public long size()close