public final class TypeUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static Object |
castPigTypeToPhoenix(Object o,
byte objectType,
org.apache.phoenix.schema.types.PDataType targetPhoenixType)
This method encodes a value with Phoenix data type.
|
static Byte |
getPigDataTypeForPhoenixType(org.apache.phoenix.schema.types.PDataType phoenixDataType)
Returns the mapping pig data type for a given phoenix data type.
|
static org.apache.phoenix.schema.types.PDataType |
getType(Object obj,
byte type)
This method returns the most appropriate PDataType associated with the incoming Pig type.
|
static org.apache.pig.data.Tuple |
transformToTuple(org.apache.phoenix.mapreduce.PhoenixRecordWritable record,
org.apache.pig.ResourceSchema.ResourceFieldSchema[] projectedColumns)
Transforms the PhoenixRecord to Pig
Tuple. |
public static org.apache.phoenix.schema.types.PDataType getType(Object obj, byte type)
castPigTypeToPhoenix(Object, byte, PDataType)obj - public static Object castPigTypeToPhoenix(Object o, byte objectType, org.apache.phoenix.schema.types.PDataType targetPhoenixType) throws SQLException
Tuple is mapped
to a PArrayDataType . It then checks if it is BINARY and makes
a call to castBytes(Object, PDataType) to convert bytes to targetPhoenixType. It returns a RuntimeException
when object can not be coerced.o - targetPhoenixType - SQLExceptionpublic static org.apache.pig.data.Tuple transformToTuple(org.apache.phoenix.mapreduce.PhoenixRecordWritable record,
org.apache.pig.ResourceSchema.ResourceFieldSchema[] projectedColumns)
throws IOException
Tuple.record - projectedColumns - IOExceptionpublic static Byte getPigDataTypeForPhoenixType(org.apache.phoenix.schema.types.PDataType phoenixDataType)
phoenixDataType - Copyright © 2021 Apache Software Foundation. All rights reserved.