public static enum RecordBatch.IterOutcome extends Enum<RecordBatch.IterOutcome>
RecordBatch.next().
Key characteristics of the return value sequence:
OK_NEW_SCHEMA always appears unless STOP appears. (A
batch returns OK_NEW_SCHEMA before returning NONE even
if the batch has zero rows.)
OK_NEW_SCHEMA always appears before OK appears.NONE or STOP, and NONE
and STOP appear only as the last value.
For normal completion, the basic sequence of return values from calls to
next() on a RecordBatch is:
OK_NEW_SCHEMA value followed by zero or more OK
values,
OK_NEW_SCHEMA value
followed by zero or more OK values, and then
NONE value.
In addition to that basic sequence, NOT_YET
values can appear anywhere in the subsequence
before the terminal value (NONE or STOP).
For abnormal termination, the sequence is truncated (before the
NONE) and ends with an exception. That is, the sequence begins
with a subsequence that is some prefix of a normal-completion sequence
and that does not contain NONE, and ends with the
caller throwing a (query-fatal) exception.
The normal-completion return sequence is matched by the following regular-expression-style grammar:
( NOT_YET* OK_NEW_SCHEMA
NOT_YET* OK )*
)+
NOT_YET* <exception>
OUT_OF_MEMORY state was never really used.
It is now handled by calling
FragmentContext#requestMemory()
at the point that the operator realizes it is short on memory.
The former STOP state was replaced with a "fail fast"
approach that throws an exception when an error is detected.
| Enum Constant and Description |
|---|
EMIT
Emit record to produce output batches.
|
NONE
Normal completion of batch.
|
NOT_YET
No data yet.
|
OK
Zero or more records with same schema.
|
OK_NEW_SCHEMA
New schema, maybe with records.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isError() |
static RecordBatch.IterOutcome |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static RecordBatch.IterOutcome[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RecordBatch.IterOutcome NONE
The call to RecordBatch.next()
read no records,
the batch has and will have no more results to return,
and next() must not be called again.
This value will be returned only after OK_NEW_SCHEMA has been
returned at least once (not necessarily immediately after).
Also after a RecordBatch returns NONE a RecordBatch should:
public static final RecordBatch.IterOutcome OK
The call to RecordBatch.next()
read zero or more records,
the schema has not changed since the last time OK_NEW_SCHEMA
was returned,
and the batch will have more results to return (at least completion or
abnormal termination (NONE or STOP)).
(next() should be called again.)
This will be returned only after OK_NEW_SCHEMA has been
returned at least once (not necessarily immediately after).
public static final RecordBatch.IterOutcome OK_NEW_SCHEMA
The call to RecordBatch.next()
changed the schema and vector structures
and read zero or more records,
and the batch will have more results to return (at least completion or
abnormal termination (NONE or STOP)).
(next() should be called again.)
public static final RecordBatch.IterOutcome NOT_YET
The call to RecordBatch.next()
read no data,
and the batch will have more results to return in the future (at least
completion or abnormal termination (NONE or STOP)).
The caller should call next() again, but should do so later
(including by returning NOT_YET to its caller).
Normally, the caller should perform any locally available work while waiting for incoming data from the callee, for example, doing partial sorts on already received data while waiting for additional data to sort.
Used by batches that haven't received incoming data yet.
public static final RecordBatch.IterOutcome EMIT
The call to RecordBatch.next(),
read zero or more records with no change in schema as compared to last
time. It is an indication from upstream operator to unblock and
produce an output batch based on all the records current operator
possess. The caller should return this outcome to it's downstream
operators except LateralJoinRecordBatch, which will consume any EMIT
from right branch but will pass through EMIT from left branch.
Caller should produce one or more output record batch based on all the current data and restart fresh for any new input. If there are multiple output batches then caller should send EMIT only with last batch and OK with all previous batches. For example: Hash Join when received EMIT on build side will stop build side and call next() on probe side until it sees EMIT. On seeing EMIT from probe side, it should perform JOIN and produce output batches. Later it should clear all the data on both build and probe side of input and again start from build side.
public static RecordBatch.IterOutcome[] values()
for (RecordBatch.IterOutcome c : RecordBatch.IterOutcome.values()) System.out.println(c);
public static RecordBatch.IterOutcome valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic boolean isError()
Copyright © 2021 The Apache Software Foundation. All rights reserved.