&& (qrb.getHeader().getRowCount() == 0 && qrb.getData() == null)) { if (qrb.getHeader().hasAffectedRowsCount()) { int updateCount = qrb.getHeader().getAffectedRowsCount(); int currentUpdateCount = statement.getUpdateCount() == -1 ? 0 : statement.getUpdateCount(); ((DrillStatement) statement).setUpdateCount(updateCount + currentUpdateCount); schemaChanged = currentBatchHolder.load(qrb.getHeader().getDef(), qrb.getData());
&& ( qrb.getHeader().getRowCount() == 0 || qrb.getData() == null ) ) { if (qrb.getHeader().hasAffectedRowsCount()) { int updateCount = qrb.getHeader().getAffectedRowsCount(); int currentUpdateCount = statement.getUpdateCount() == -1 ? 0 : statement.getUpdateCount(); ((DrillStatement) statement).setUpdateCount(updateCount + currentUpdateCount); schemaChanged = currentBatchHolder.load(qrb.getHeader().getDef(), qrb.getData());
final int rows = result.getHeader().getRowCount(); final BufferAllocator allocator = webSessionResources.getAllocator(); final DrillBuf bufferWithData = allocator.buffer(dataByteCount); loader.load(result.getHeader().getDef(), bufferWithData);
QueryData header = QueryData.newBuilder() .setQueryId(context.getHandle().getQueryId()) .setRowCount(0)
count.addAndGet(header.getRowCount()); try { loader.load(header.getDef(), data);
return QueryResult.getDefaultInstance(); case RpcType.QUERY_DATA_VALUE: return QueryData.getDefaultInstance(); case RpcType.QUERY_PLAN_FRAGMENTS_VALUE: return QueryPlanFragments.getDefaultInstance();
/** * Maps internal low-level API protocol to {@link UserResultsListener}-level API protocol. * handles query data messages */ public void batchArrived( ConnectionThrottle throttle, ByteBuf pBody, ByteBuf dBody ) throws RpcException { final QueryData queryData = RpcBus.get( pBody, QueryData.PARSER ); // Current batch coming in. final DrillBuf drillBuf = (DrillBuf) dBody; final QueryDataBatch batch = new QueryDataBatch( queryData, drillBuf ); final QueryId queryId = queryData.getQueryId(); if (logger.isDebugEnabled()) { logger.debug("batchArrived: queryId = {}", QueryIdHelper.getQueryId(queryId)); } logger.trace( "batchArrived: batch = {}", batch ); final UserResultsListener resultsListener = newUserResultsListener(queryId); // A data case--pass on via dataArrived try { resultsListener.dataArrived(batch, throttle); // That releases batch if successful. } catch ( Exception e ) { batch.release(); resultsListener.submissionFailed(UserException.systemError(e).build(logger)); } }
public Builder toBuilder() { return newBuilder(this); }
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.QueryData other) { if (other == org.apache.drill.exec.proto.UserBitShared.QueryData.getDefaultInstance()) return this; if (other.hasQueryId()) { mergeQueryId(other.getQueryId()); } if (other.hasRowCount()) { setRowCount(other.getRowCount()); } if (other.hasDef()) { mergeDef(other.getDef()); } if (other.hasAffectedRowsCount()) { setAffectedRowsCount(other.getAffectedRowsCount()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(org.apache.drill.exec.proto.UserBitShared.QueryData prototype) {
public org.apache.drill.exec.proto.UserBitShared.QueryData getDefaultInstanceForType() { return org.apache.drill.exec.proto.UserBitShared.QueryData.getDefaultInstance(); }
public QueryWritableBatch convertNext() { WritableBatch w = batch.getWritableBatch().transfer(allocator); QueryData.Builder builder = QueryData.newBuilder() .setQueryId(queryId) .setRowCount(batch.getRecordCount()) .setDef(w.getDef()); if (!options.getBoolean(ExecConstants.RETURN_RESULT_SET_FOR_DDL)) { int count = w.getDef().getAffectedRowsCount(); builder.setAffectedRowsCount(count == -1 ? 0 : count); } return new QueryWritableBatch(builder.build(), w.getBuffers()); } }
public static Builder newBuilder(org.apache.drill.exec.proto.UserBitShared.QueryData prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); }
public org.apache.drill.exec.proto.UserBitShared.QueryData.Builder newMessage() { return org.apache.drill.exec.proto.UserBitShared.QueryData.newBuilder(); } public java.lang.String getFieldName(int number)
@Override public void dataArrived(QueryDataBatch result, ConnectionThrottle throttle) { count.addAndGet(result.getHeader().getRowCount()); child.dataArrived(result, throttle); }
@Override public void sendData(RpcOutcomeListener<Ack> listener, QueryWritableBatch result) { // Save the query results schema and release the buffers. if (fields == null) { fields = result.getHeader().getDef().getFieldList(); } for (ByteBuf buf : result.getBuffers()) { buf.release(); } listener.success(Acks.OK, null); }
public void writeTo(com.dyuproject.protostuff.Output output, org.apache.drill.exec.proto.UserBitShared.QueryData message) throws java.io.IOException { if(message.hasQueryId()) output.writeObject(1, message.getQueryId(), org.apache.drill.exec.proto.SchemaUserBitShared.QueryId.WRITE, false); if(message.hasRowCount()) output.writeInt32(2, message.getRowCount(), false); if(message.hasDef()) output.writeObject(3, message.getDef(), org.apache.drill.exec.proto.SchemaUserBitShared.RecordBatchDef.WRITE, false); if(message.hasAffectedRowsCount()) output.writeInt32(4, message.getAffectedRowsCount(), false); } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryData message)
batchLoader.load(result.getHeader().getDef(), result.getData()); if (batchLoader.getRecordCount() <= 0) { result.release();
batchLoader.load(result.getHeader().getDef(), result.getData()); if (batchLoader.getRecordCount() <= 0) { result.release();
protected Object[] getRunResult(QueryType queryType, String planString) throws Exception { List<QueryDataBatch> resultList = testRunAndReturn(queryType, planString); List<Object> res = new ArrayList<Object>(); RecordBatchLoader loader = new RecordBatchLoader(getAllocator()); for(QueryDataBatch result : resultList) { if (result.getData() != null) { loader.load(result.getHeader().getDef(), result.getData()); ValueVector v = loader.iterator().next().getValueVector(); for (int j = 0; j < v.getAccessor().getValueCount(); j++) { if (v instanceof VarCharVector) { res.add(new String(((VarCharVector) v).getAccessor().get(j))); } else { res.add(v.getAccessor().getObject(j)); } } loader.clear(); result.release(); } } return res.toArray(); }