public class ProjectionChecker extends Object
a[0]
(and array), but the reader offer up a
as a non-array column.
Checks are reasonable, but not complete. Particularly in the DICT
case, projection depends on multiple factors, such as the type of the
key and values. This class does not (yet) handle that complexity.
Instead, the goal is no false negatives for the complex cases, while
catching the simple cases.
The Project operator or other consuming operator is the final arbitrator of whether a particular column satisfies a particular projection. This class tries to catch those errors early to provide better error messages.
Modifier and Type | Method and Description |
---|---|
static boolean |
isConsistent(RequestedColumn colReq,
ColumnMetadata readCol)
Check if the given read column is consistent with the projection requested for
that column.
|
static boolean |
isConsistent(RequestedTuple tuple,
ColumnMetadata readCol)
Check if the given read column is consistent with the projection requested for
a tuple.
|
static void |
validateProjection(RequestedColumn colReq,
ColumnMetadata readCol) |
static void |
validateProjection(RequestedColumn colReq,
ColumnMetadata readCol,
CustomErrorContext errorContext)
Perform the column-level projection as described in
isConsistent(RequestedColumn, ColumnMetadata) , and raise a
UserException if the column is not consistent with projection. |
public static boolean isConsistent(RequestedTuple tuple, ColumnMetadata readCol)
tuple
- the tuple-level projection descriptionreadCol
- metadata for the column which the reader has actually
producedtrue
if the column is consistent with projection (or if the
column is too complex to check), false
if the column is not
consistent and represents an error case. Also returns true
if
the column is not projected, as any type of column can be ignoredpublic static boolean isConsistent(RequestedColumn colReq, ColumnMetadata readCol)
colReq
- the column-level projection descriptionreadCol
- metadata for the column which the reader has actually
producedtrue
if the column is consistent with projection (or if the
column is too complex to check), false
if the column is not
consistent and represents an error case. Also returns true
if
the column is not projected, as any type of column can be ignoredpublic static void validateProjection(RequestedColumn colReq, ColumnMetadata readCol)
public static void validateProjection(RequestedColumn colReq, ColumnMetadata readCol, CustomErrorContext errorContext)
isConsistent(RequestedColumn, ColumnMetadata)
, and raise a
UserException
if the column is not consistent with projection.colReq
- the column-level projection descriptionreadCol
- metadata for the column which the reader has actually
producederrorContext
- additional error context to pass along in the
exceptionUserException
- if the read column is not consistent with the
projection description for the columnCopyright © 1970 The Apache Software Foundation. All rights reserved.