本文整理汇总了Java中org.apache.calcite.avatica.util.Cursor类的典型用法代码示例。如果您正苦于以下问题:Java Cursor类的具体用法?Java Cursor怎么用?Java Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cursor类属于org.apache.calcite.avatica.util包,在下文中一共展示了Cursor类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: close
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
public void close() {
closed = true;
final Cursor cursor = this.cursor;
if (cursor != null) {
this.cursor = null;
cursor.close();
}
statement.onResultSetClose(this);
// TODO: for timeout, see IteratorResultSet.close
/*
if (timeoutCursor != null) {
final long noTimeout = 0;
timeoutCursor.close(noTimeout);
timeoutCursor = null;
}
*/
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:18,代码来源:AvaticaResultSet.java
示例2: create
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
@Override
public ResultSet create(ColumnMetaData.AvaticaType elementType,
Iterable<Object> iterable) {
final List<ColumnMetaData> columnMetaDataList;
if (elementType instanceof ColumnMetaData.StructType) {
columnMetaDataList = ((ColumnMetaData.StructType) elementType).columns;
} else {
columnMetaDataList =
ImmutableList.of(ColumnMetaData.dummy(elementType, false));
}
final CalcitePrepare.CalciteSignature signature =
(CalcitePrepare.CalciteSignature) this.signature;
final CalcitePrepare.CalciteSignature<Object> newSignature =
new CalcitePrepare.CalciteSignature<>(signature.sql,
signature.parameters, signature.internalParameters,
signature.rowType, columnMetaDataList, Meta.CursorFactory.ARRAY,
ImmutableList.<RelCollation>of(), -1, null);
ResultSetMetaData subResultSetMetaData =
new AvaticaResultSetMetaData(statement, null, newSignature);
final CalciteResultSet resultSet =
new CalciteResultSet(statement, signature, subResultSetMetaData,
localCalendar.getTimeZone(), new Meta.Frame(0, true, iterable));
final Cursor cursor = resultSet.createCursor(elementType, iterable);
return resultSet.execute2(cursor, columnMetaDataList);
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:26,代码来源:CalciteResultSet.java
示例3: create
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
@Override
public ResultSet create(ColumnMetaData.AvaticaType elementType,
Iterable<Object> iterable) {
final List<ColumnMetaData> columnMetaDataList;
if (elementType instanceof ColumnMetaData.StructType) {
columnMetaDataList = ((ColumnMetaData.StructType) elementType).columns;
} else {
columnMetaDataList =
ImmutableList.of(ColumnMetaData.dummy(elementType, false));
}
final CalcitePrepare.CalciteSignature signature =
(CalcitePrepare.CalciteSignature) this.signature;
final CalcitePrepare.CalciteSignature<Object> newSignature =
new CalcitePrepare.CalciteSignature<>(signature.sql,
signature.parameters, signature.internalParameters,
signature.rowType, columnMetaDataList, Meta.CursorFactory.ARRAY,
signature.rootSchema, ImmutableList.<RelCollation>of(), -1, null);
ResultSetMetaData subResultSetMetaData =
new AvaticaResultSetMetaData(statement, null, newSignature);
final QuarkResultSet resultSet =
new QuarkResultSet(statement, signature, subResultSetMetaData,
localCalendar.getTimeZone(), new Meta.Frame(0, true, iterable));
final Cursor cursor = resultSet.createCursor(elementType, iterable);
return resultSet.execute2(cursor, columnMetaDataList);
}
开发者ID:qubole,项目名称:quark,代码行数:26,代码来源:QuarkResultSet.java
示例4: create
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
@Override public ResultSet create(ColumnMetaData.AvaticaType elementType,
Iterable<Object> iterable) {
final List<ColumnMetaData> columnMetaDataList;
if (elementType instanceof ColumnMetaData.StructType) {
columnMetaDataList = ((ColumnMetaData.StructType) elementType).columns;
} else {
columnMetaDataList =
ImmutableList.of(ColumnMetaData.dummy(elementType, false));
}
final CalcitePrepare.CalciteSignature signature =
(CalcitePrepare.CalciteSignature) this.signature;
final CalcitePrepare.CalciteSignature<Object> newSignature =
new CalcitePrepare.CalciteSignature<>(signature.sql,
signature.parameters, signature.internalParameters,
signature.rowType, columnMetaDataList, Meta.CursorFactory.ARRAY,
signature.rootSchema, ImmutableList.<RelCollation>of(), -1, null,
statement.getStatementType());
ResultSetMetaData subResultSetMetaData =
new AvaticaResultSetMetaData(statement, null, newSignature);
final CalciteResultSet resultSet =
new CalciteResultSet(statement, signature, subResultSetMetaData,
localCalendar.getTimeZone(), new Meta.Frame(0, true, iterable));
final Cursor cursor = resultSet.createCursor(elementType, iterable);
return resultSet.execute2(cursor, columnMetaDataList);
}
开发者ID:apache,项目名称:calcite,代码行数:26,代码来源:CalciteResultSet.java
示例5: createCursor
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
/** Uses a {@link org.apache.calcite.avatica.Meta.CursorFactory} to convert
* an {@link Iterable} into a
* {@link org.apache.calcite.avatica.util.Cursor}. */
public static Cursor createCursor(CursorFactory cursorFactory,
Iterable<Object> iterable) {
switch (cursorFactory.style) {
case OBJECT:
return new IteratorCursor<Object>(iterable.iterator()) {
protected Getter createGetter(int ordinal) {
return new ObjectGetter(ordinal);
}
};
case ARRAY:
@SuppressWarnings("unchecked") final Iterable<Object[]> iterable1 =
(Iterable<Object[]>) (Iterable) iterable;
return new ArrayIteratorCursor(iterable1.iterator());
case RECORD:
@SuppressWarnings("unchecked") final Class<Object> clazz =
cursorFactory.clazz;
return new RecordIteratorCursor<Object>(iterable.iterator(), clazz);
case RECORD_PROJECTION:
@SuppressWarnings("unchecked") final Class<Object> clazz2 =
cursorFactory.clazz;
return new RecordIteratorCursor<Object>(iterable.iterator(), clazz2,
cursorFactory.fields);
case LIST:
@SuppressWarnings("unchecked") final Iterable<List<Object>> iterable2 =
(Iterable<List<Object>>) (Iterable) iterable;
return new ListIteratorCursor(iterable2.iterator());
case MAP:
@SuppressWarnings("unchecked") final Iterable<Map<String, Object>>
iterable3 =
(Iterable<Map<String, Object>>) (Iterable) iterable;
return new MapIteratorCursor(iterable3.iterator(),
cursorFactory.fieldNames);
default:
throw new AssertionError("unknown style: " + cursorFactory.style);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:40,代码来源:MetaImpl.java
示例6: getAccessor
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
/**
* Returns the accessor for column with a given index.
*
* @param columnIndex 1-based column index
* @return Accessor
* @throws SQLException if index is not valid
*/
private Cursor.Accessor getAccessor(int columnIndex) throws SQLException {
try {
return accessorList.get(columnIndex - 1);
} catch (IndexOutOfBoundsException e) {
throw new SQLException("invalid column ordinal: " + columnIndex);
}
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:15,代码来源:AvaticaResultSet.java
示例7: execute2
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
public AvaticaResultSet execute2(Cursor cursor,
List<ColumnMetaData> columnMetaDataList) {
this.cursor = cursor;
this.accessorList =
cursor.createAccessors(columnMetaDataList, localCalendar, this);
this.row = -1;
this.afterLast = false;
return this;
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:10,代码来源:AvaticaResultSet.java
示例8: getObject
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
@Override
public Object getObject( int columnIndex ) throws SQLException {
throwIfClosed();
final Cursor.Accessor accessor;
try {
accessor = accessorList.get(columnIndex - 1);
} catch (IndexOutOfBoundsException e) {
throw new SQLException("invalid column ordinal: " + columnIndex);
}
final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
// Dremio returns a float (4bytes) for a SQL Float whereas Calcite would return a double (8bytes)
int typeId = (metaData.type.id != Types.FLOAT) ? metaData.type.id : Types.REAL;
return AvaticaSite.get(accessor, typeId, localCalendar);
}
开发者ID:dremio,项目名称:dremio-oss,代码行数:16,代码来源:DremioResultSetImpl.java
示例9: getObject
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
@Override
public Object getObject( int columnIndex ) throws SQLException {
throwIfClosed();
final Cursor.Accessor accessor;
try {
accessor = accessorList.get(columnIndex - 1);
} catch (IndexOutOfBoundsException e) {
throw new SQLException("invalid column ordinal: " + columnIndex);
}
final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
// Drill returns a float (4bytes) for a SQL Float whereas Calcite would return a double (8bytes)
int typeId = (metaData.type.id != Types.FLOAT) ? metaData.type.id : Types.REAL;
return AvaticaSite.get(accessor, typeId, localCalendar);
}
开发者ID:axbaretto,项目名称:drill,代码行数:16,代码来源:DrillResultSetImpl.java
示例10: createCursor
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
private Cursor createCursor(ColumnMetaData.AvaticaType elementType,
Iterable iterable) {
final Enumerator enumerator = Linq4j.iterableEnumerator(iterable);
//noinspection unchecked
return !(elementType instanceof ColumnMetaData.StructType)
|| ((ColumnMetaData.StructType) elementType).columns.size() == 1
? new ObjectEnumeratorCursor(enumerator)
: new ArrayEnumeratorCursor(enumerator);
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:10,代码来源:CalciteResultSet.java
示例11: createCursor
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
private Cursor createCursor(ColumnMetaData.AvaticaType elementType,
Iterable iterable) {
final Enumerator enumerator = Linq4j.iterableEnumerator(iterable);
//noinspection unchecked
return !(elementType instanceof ColumnMetaData.StructType)
|| ((ColumnMetaData.StructType) elementType).columns.size() == 1
? new ObjectEnumeratorCursor(enumerator)
: new ArrayEnumeratorCursor(enumerator);
}
开发者ID:qubole,项目名称:quark,代码行数:10,代码来源:QuarkResultSet.java
示例12: createCursor
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
private Cursor createCursor(ColumnMetaData.AvaticaType elementType,
Iterable iterable) {
final Enumerator enumerator = Linq4j.iterableEnumerator(iterable);
//noinspection unchecked
return !(elementType instanceof ColumnMetaData.StructType)
|| ((ColumnMetaData.StructType) elementType).columns.size() == 1
? new ObjectEnumeratorCursor(enumerator)
: new ArrayEnumeratorCursor(enumerator);
}
开发者ID:apache,项目名称:calcite,代码行数:10,代码来源:CalciteResultSet.java
示例13: getObject
import org.apache.calcite.avatica.util.Cursor; //导入依赖的package包/类
public Object getObject(int columnIndex) throws SQLException {
final Cursor.Accessor accessor = getAccessor(columnIndex);
final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
return AvaticaSite.get(accessor, metaData.type.id, localCalendar);
}
开发者ID:apache,项目名称:calcite-avatica,代码行数:6,代码来源:AvaticaResultSet.java
注:本文中的org.apache.calcite.avatica.util.Cursor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论