Enum RecordBatch.IterOutcome
- All Implemented Interfaces:
Serializable
,Comparable<RecordBatch.IterOutcome>
- Enclosing interface:
- RecordBatch
RecordBatch.next()
.
Key characteristics of the return value sequence:
-
OK_NEW_SCHEMA
always appears unlessSTOP
appears. (A batch returnsOK_NEW_SCHEMA
before returningNONE
even if the batch has zero rows.) OK_NEW_SCHEMA
always appears beforeOK
appears.-
The last value is always
NONE
orSTOP
, andNONE
andSTOP
appear only as the last value.
Details
For normal completion, the basic sequence of return values from calls to
next()
on a RecordBatch
is:
-
an
OK_NEW_SCHEMA
value followed by zero or moreOK
values, -
zero or more subsequences each having an
OK_NEW_SCHEMA
value followed by zero or moreOK
values, and then -
a
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>
Obsolete Outcomes
The formerOUT_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 Summary
Enum ConstantDescriptionEmit record to produce output batches.Normal completion of batch.No data yet.Zero or more records with same schema.New schema, maybe with records. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isError()
static RecordBatch.IterOutcome
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.
-
Enum Constant Details
-
NONE
Normal completion of batch.The call to
RecordBatch.next()
read no records, the batch has and will have no more results to return, andnext()
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:
- Contain the last valid schema seen by the operator.
- Contain a VectorContainer with empty columns corresponding to the last valid schema.
- Return a record count of 0.
-
OK
Zero or more records with same schema.The call to
RecordBatch.next()
read zero or more records, the schema has not changed since the last timeOK_NEW_SCHEMA
was returned, and the batch will have more results to return (at least completion or abnormal termination (NONE
orSTOP
)). (next()
should be called again.)This will be returned only after
OK_NEW_SCHEMA
has been returned at least once (not necessarily immediately after). -
OK_NEW_SCHEMA
New schema, maybe with records.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
orSTOP
)). (next()
should be called again.) -
NOT_YET
No data 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
orSTOP
)). The caller should callnext()
again, but should do so later (including by returningNOT_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.
-
EMIT
Emit record to produce output batches.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.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
isError
public boolean isError()
-