Java Code Examples for org.apache.calcite.avatica.Meta#ExecuteResult
The following examples show how to use
org.apache.calcite.avatica.Meta#ExecuteResult .
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: LocalService.java From calcite-avatica with Apache License 2.0 | 6 votes |
public ExecuteResponse apply(ExecuteRequest request) { try (final Context ignore = executeTimer.start()) { try { final Meta.ExecuteResult executeResult = meta.execute(request.statementHandle, request.parameterValues, AvaticaUtils.toSaturatedInt(request.maxRowCount)); final List<ResultSetResponse> results = new ArrayList<>(executeResult.resultSets.size()); for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) { results.add(toResponse(metaResultSet)); } return new ExecuteResponse(results, false, serverLevelRpcMetadata); } catch (NoSuchStatementException e) { return new ExecuteResponse(null, true, serverLevelRpcMetadata); } } }
Example 2
Source File: QuarkMetaImpl.java From quark with Apache License 2.0 | 6 votes |
public Meta.ExecuteResult prepareAndExecute(Meta.StatementHandle h, String sql, long maxRowCount, Meta.PrepareCallback callback) { try { MetaResultSet metaResultSet = null; synchronized (callback.getMonitor()) { callback.clear(); ParserResult result = getConnection().parse(sql); metaResultSet = new PlanExecutor(h, getConnection(), connectionCache, maxRowCount).execute(result); callback.assign(metaResultSet.signature, metaResultSet.firstFrame, metaResultSet.updateCount); } callback.execute(); return new ExecuteResult(ImmutableList.of(metaResultSet)); } catch (Exception e) { throw propagate(e); } }
Example 3
Source File: RemoteMetaTest.java From calcite-avatica with Apache License 2.0 | 5 votes |
private static Meta.ExecuteResult prepareAndExecuteInternal(AvaticaConnection conn, final AvaticaStatement statement, String sql, int maxRowCount) throws Exception { Method m = AvaticaConnection.class.getDeclaredMethod("prepareAndExecuteInternal", AvaticaStatement.class, String.class, long.class); m.setAccessible(true); return (Meta.ExecuteResult) m.invoke(conn, statement, sql, maxRowCount); }
Example 4
Source File: AlternatingRemoteMetaTest.java From calcite-avatica with Apache License 2.0 | 5 votes |
private static Meta.ExecuteResult prepareAndExecuteInternal(AvaticaConnection conn, final AvaticaStatement statement, String sql, int maxRowCount) throws Exception { Method m = AvaticaConnection.class.getDeclaredMethod("prepareAndExecuteInternal", AvaticaStatement.class, String.class, long.class); m.setAccessible(true); return (Meta.ExecuteResult) m.invoke(conn, statement, sql, maxRowCount); }
Example 5
Source File: LocalService.java From calcite-avatica with Apache License 2.0 | 5 votes |
public ExecuteResponse apply(PrepareAndExecuteRequest request) { try (final Context ignore = prepareAndExecuteTimer.start()) { final Meta.StatementHandle sh = new Meta.StatementHandle(request.connectionId, request.statementId, null); try { final Meta.ExecuteResult executeResult = meta.prepareAndExecute(sh, request.sql, request.maxRowCount, request.maxRowsInFirstFrame, new Meta.PrepareCallback() { @Override public Object getMonitor() { return LocalService.class; } @Override public void clear() { } @Override public void assign(Meta.Signature signature, Meta.Frame firstFrame, long updateCount) { } @Override public void execute() { } }); final List<ResultSetResponse> results = new ArrayList<>(); for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) { results.add(toResponse(metaResultSet)); } return new ExecuteResponse(results, false, serverLevelRpcMetadata); } catch (NoSuchStatementException e) { // The Statement doesn't exist anymore, bubble up this information return new ExecuteResponse(null, true, serverLevelRpcMetadata); } } }