public PlanRequestResult(TPlanRequestResult result) { tasks = Task.fromThrift(result.tasks); schema = new Schema(result.schema); requestId = new UniqueId(result.request_id); hosts = NetworkAddress.fromThrift(result.hosts); warnings = LogMessage.fromThrift(result.warnings); } }
TaskStatus(TTaskStatus status) { stats = new Stats(status.stats); dataErrors = LogMessage.fromThrift(status.data_errors); warnings = LogMessage.fromThrift(status.warnings); } }
GetSchemaResult(TGetSchemaResult result) { schema = new Schema(result.schema); warnings = LogMessage.fromThrift(result.warnings); } }
/** * Get the plan request result. */ public PlanRequestResult planRequest(String hostname, int port, Request request) throws IOException, RecordServiceException { try { client_.connect(hostname, port); return client_.planRequest(request); } finally { client_.close(); } }
/** * Returns true if there are more records, false otherwise. */ @Override public boolean hasNext() throws IOException, RecordServiceException { return records_.hasNext(); }
/** * Creates a worker client connecting to 'hostname'/'port' with previously * set options, and the caller must call close(). */ public RecordServiceWorkerClient connect(String hostname, int port) throws RecordServiceException, IOException { client_.connect(hostname, port); return client_; }
/** * Executes the task asynchronously, returning the handle to the client. */ public TaskState execTask(Task task) throws RecordServiceException, IOException { validateIsConnected(); return execTaskInternal(task, 0); }
Task(TTask t) { localHosts = NetworkAddress.fromThrift(t.local_hosts); task = t.task.array(); taskId = new UniqueId(t.task_id); resultsOrdered = t.results_ordered; taskSize = t.task_size; }
private void nextBatch() throws IOException, RecordServiceException { if (handle_ == null) { throw new RuntimeException("Task has been closed already."); } fetchResult_ = worker_.fetch(handle_); if (fetchResult_.recordFormat != FetchResult.RecordFormat.Columnar) { throw new RuntimeException("Unsupported record format"); } record_.reset(fetchResult_); progress_ = (float)fetchResult_.taskProgress; }
ColumnDesc(TColumnDesc desc) { name = desc.name; type = new TypeDesc(desc.type); } }
RecordServiceException(String msg, TRecordServiceException e) { super(msg, e); code = ErrorCode.fromThrift(e.code); message = msg + e.message; detail = e.detail; } }
/** * Opens a connection to the RecordServicePlanner. * Will retry maxAttempts_ if it got SERVICE_BUSY error. */ private void connect(String hostname, int port) throws IOException, RecordServiceException { connect(hostname, port, maxAttempts_); }
LogMessage(TLogMessage msg) { message = msg.message; detail = msg.detail; level = LoggingLevel.fromThrift(msg.level); count = msg.count; }
/** * Creates a ByteArray wrapper object. * @param buffer Underlying buffer. * @param offset Offset to start in buffer. * @param len Length of data. */ public ByteArray(ByteBuffer buffer, int offset, int len) { set(buffer, offset, len); }
private TaskState(Task task, TExecTaskResult result) { task_ = task; handle_ = result.handle; schema_ = new Schema(result.schema); }
public final Decimal nextDecimal(int colIdx) { int len = byteArrayLen_[colIdx]; long offset = colOffsets_[colIdx] - byteArrayOffset; decimalVals_[colIdx].set(colData_[colIdx], (int)offset, len); colOffsets_[colIdx] += len; return decimalVals_[colIdx]; }
/** * Returns the protocol version of the connected service. */ public ProtocolVersion getProtocolVersion() throws RuntimeException { validateIsConnected(); return protocolVersion_; }
/** * Returns true if there are more records, false otherwise. */ @Override public boolean hasNext() throws IOException, RecordServiceException { return records_.hasNext(); }
/** * Creates a worker client connecting to the 'address' with previously * set options, and the caller must call close(). */ public RecordServiceWorkerClient connect(NetworkAddress address) throws RecordServiceException, IOException { return connect(address.hostname, address.port); } }