Map the catalyst expression to ObjectInspector, however, if the expression is Literal or foldable, a constant writable object inspector returns; Otherwise, we always get the object inspector according to its data type(in catalyst)
Catalyst expression to be mapped
Hive java objectinspector (recursively).
Catalyst data type
Hive java object inspector (recursively), not the Writable ObjectInspector We can easily map to the Hive built-in object inspector according to the data type.
Converts hive types to native catalyst types.
the data in Hive type
the ObjectInspector associated with the Hive Type
convert the data into catalyst type
TODO return the function of (data => Any) instead for performance consideration
Strictly follows the following order in unwrapping (constant OI has the higher priority):
Constant Null object inspector =>
Constant object inspector =>
extract the value from constant object inspector
Check whether the
data is null =>
return null if true
If object inspector prefers writable =>
extract writable from
data and then get the catalyst type from the writable
Extract the java object directly from the object inspector
NOTICE: the complex data type requires recursive unwrapping.
Builds specific unwrappers ahead of time according to object inspector types to avoid pattern matching and branching costs per row.
Converts native catalyst types to the types expected by Hive
the value to be wrapped
This ObjectInspector associated with the value returned by this function, and
the ObjectInspector should also be consistent with those returned from
toInspector: DataType => ObjectInspector and
toInspector: Expression => ObjectInspector
Strictly follows the following order in wrapping (constant OI has the higher priority):
Constant object inspector => return the bundled value of Constant object inspector
Check whether the
a is null => return null if true
If object inspector prefers writable object => return a Writable for the given data
Map the catalyst data to the boxed java primitive
NOTICE: the complex data type requires recursive wrapping.
Wraps with Hive types based on object inspector.