org.apache.calcite.avatica.AvaticaResultSetMetaData Java Examples
The following examples show how to use
org.apache.calcite.avatica.AvaticaResultSetMetaData.
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: CalciteResultSet.java From Quicksql with MIT License | 6 votes |
@Override public ResultSet create(ColumnMetaData.AvaticaType elementType, Iterable<Object> iterable) throws SQLException { 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.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); }
Example #2
Source File: ArrayFactoryImpl.java From calcite-avatica with Apache License 2.0 | 6 votes |
@Override public ResultSet create(AvaticaType elementType, Iterable<Object> elements) throws SQLException { // The ColumnMetaData for offset "1" in the ResultSet for an Array. ScalarType arrayOffsetType = ColumnMetaData.scalar(Types.INTEGER, "INTEGER", Rep.PRIMITIVE_INT); // Two columns (types) in the ResultSet we will create List<ColumnMetaData> types = Arrays.asList(ColumnMetaData.dummy(arrayOffsetType, false), ColumnMetaData.dummy(elementType, true)); List<List<Object>> rows = createResultSetRowsForArrayData(elements); // `(List<Object>) rows` is a compile error. @SuppressWarnings({ "unchecked", "rawtypes" }) List<Object> untypedRows = (List<Object>) ((List) rows); try (ListIteratorCursor cursor = new ListIteratorCursor(rows.iterator())) { final String sql = "MOCKED"; QueryState state = new QueryState(sql); Meta.Signature signature = new Meta.Signature(types, sql, Collections.<AvaticaParameter>emptyList(), Collections.<String, Object>emptyMap(), Meta.CursorFactory.LIST, Meta.StatementType.SELECT); AvaticaResultSetMetaData resultSetMetaData = new AvaticaResultSetMetaData(null, sql, signature); Meta.Frame frame = new Meta.Frame(0, true, untypedRows); AvaticaResultSet resultSet = new AvaticaResultSet(null, state, signature, resultSetMetaData, timeZone, frame); resultSet.execute2(cursor, types); return resultSet; } }
Example #3
Source File: QuarkResultSet.java From quark with Apache License 2.0 | 6 votes |
@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); }
Example #4
Source File: CalciteResultSet.java From calcite with Apache License 2.0 | 6 votes |
@Override public ResultSet create(ColumnMetaData.AvaticaType elementType, Iterable<Object> iterable) throws SQLException { 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.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); }
Example #5
Source File: QuicksqlServerMeta.java From Quicksql with MIT License | 5 votes |
protected QuicksqlServerResultSet getResultSet(StatementHandle h, String sql, int maxResNum, QueryResult result) throws Exception { final List<ColumnMetaData> columnMetaDataList = new ArrayList<>(); columnMetaDataList.addAll(result.columnMeta); final StatementInfo info = getStatementCache().getIfPresent(h.id); Signature signature = preparedSignature(result, sql); Cursor cursor = MetaImpl.createCursor(signature.cursorFactory, result.iterable); QuicksqlResultSet quickSqlResultSet = new QuicksqlResultSet((AvaticaStatement) info.statement, signature, new AvaticaResultSetMetaData((AvaticaStatement) info.statement, null, signature), TimeZone.getDefault(), null); quickSqlResultSet.execute2(cursor, columnMetaDataList); info.setResultSet(quickSqlResultSet); return QuicksqlServerResultSet.create(h.connectionId, h.id, quickSqlResultSet, signature, maxResNum); }
Example #6
Source File: CalciteJdbc41Factory.java From Quicksql with MIT License | 4 votes |
public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Meta.Signature signature) { return new AvaticaResultSetMetaData(statement, null, signature); }
Example #7
Source File: QuicksqlJdbc41Factory.java From Quicksql with MIT License | 4 votes |
public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Signature signature) { return new AvaticaResultSetMetaData(statement, null, signature); }
Example #8
Source File: KylinJdbcFactory.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Override public AvaticaResultSet newResultSet(AvaticaStatement statement, QueryState state, Signature signature, TimeZone timeZone, Frame firstFrame) throws SQLException { AvaticaResultSetMetaData resultSetMetaData = new AvaticaResultSetMetaData(statement, null, signature); return new KylinResultSet(statement, state, signature, resultSetMetaData, timeZone, firstFrame); }
Example #9
Source File: KylinJdbcFactory.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Override public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Signature signature) throws SQLException { return new AvaticaResultSetMetaData(statement, null, signature); }
Example #10
Source File: QuarkJdbc41Factory.java From quark with Apache License 2.0 | 4 votes |
@Override public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Meta.Signature signature) { return new AvaticaResultSetMetaData(statement, null, signature); }
Example #11
Source File: KylinJdbcFactory.java From kylin with Apache License 2.0 | 4 votes |
@Override public AvaticaResultSet newResultSet(AvaticaStatement statement, QueryState state, Signature signature, TimeZone timeZone, Frame firstFrame) throws SQLException { AvaticaResultSetMetaData resultSetMetaData = new AvaticaResultSetMetaData(statement, null, signature); return new KylinResultSet(statement, state, signature, resultSetMetaData, timeZone, firstFrame); }
Example #12
Source File: KylinJdbcFactory.java From kylin with Apache License 2.0 | 4 votes |
@Override public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Signature signature) throws SQLException { return new AvaticaResultSetMetaData(statement, null, signature); }
Example #13
Source File: CalciteJdbc41Factory.java From calcite with Apache License 2.0 | 4 votes |
public ResultSetMetaData newResultSetMetaData(AvaticaStatement statement, Meta.Signature signature) { return new AvaticaResultSetMetaData(statement, null, signature); }