org.apache.hadoop.hive.serde2
Class SerDeUtils

java.lang.Object
  extended by org.apache.hadoop.hive.serde2.SerDeUtils

public final class SerDeUtils
extends Object

SerDeUtils.


Field Summary
static char COLON
           
static char COMMA
           
static String LBRACE
           
static String LBRACKET
           
static org.apache.commons.logging.Log LOG
           
static char QUOTE
           
static String RBRACE
           
static String RBRACKET
           
 
Method Summary
static String escapeString(String str)
          Escape a String in JSON format.
static String getJSONString(Object o, ObjectInspector oi)
           
static String getJSONString(Object o, ObjectInspector oi, String nullStr)
          Use this if you need to have custom representation of top level null .
static boolean hasAnyNullObject(List o, StructObjectInspector loi, boolean[] nullSafes)
          return false though element is null if nullsafe flag is true for that
static boolean hasAnyNullObject(Object o, ObjectInspector oi)
          True if Object passed is representing null object.
static String lightEscapeString(String str)
           
static Object toThriftPayload(Object val, ObjectInspector valOI, int version)
          Convert a Object to a standard Java object in compliance with JDBC 3.0 (see JDBC 3.0 Specification, Table B-3: Mapping from JDBC Types to Java Object Types).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUOTE

public static final char QUOTE
See Also:
Constant Field Values

COLON

public static final char COLON
See Also:
Constant Field Values

COMMA

public static final char COMMA
See Also:
Constant Field Values

LBRACKET

public static final String LBRACKET
See Also:
Constant Field Values

RBRACKET

public static final String RBRACKET
See Also:
Constant Field Values

LBRACE

public static final String LBRACE
See Also:
Constant Field Values

RBRACE

public static final String RBRACE
See Also:
Constant Field Values

LOG

public static final org.apache.commons.logging.Log LOG
Method Detail

escapeString

public static String escapeString(String str)
Escape a String in JSON format.


lightEscapeString

public static String lightEscapeString(String str)

toThriftPayload

public static Object toThriftPayload(Object val,
                                     ObjectInspector valOI,
                                     int version)
Convert a Object to a standard Java object in compliance with JDBC 3.0 (see JDBC 3.0 Specification, Table B-3: Mapping from JDBC Types to Java Object Types). This method is kept consistent with HiveResultSetMetaData#hiveTypeToSqlType.


getJSONString

public static String getJSONString(Object o,
                                   ObjectInspector oi)

getJSONString

public static String getJSONString(Object o,
                                   ObjectInspector oi,
                                   String nullStr)
Use this if you need to have custom representation of top level null . (ie something other than 'null') eg, for hive output, we want to to print NULL for a null map object.

Parameters:
o - Object
oi - ObjectInspector
nullStr - The custom string used to represent null value
Returns:

hasAnyNullObject

public static boolean hasAnyNullObject(List o,
                                       StructObjectInspector loi,
                                       boolean[] nullSafes)
return false though element is null if nullsafe flag is true for that


hasAnyNullObject

public static boolean hasAnyNullObject(Object o,
                                       ObjectInspector oi)
True if Object passed is representing null object.

Parameters:
o - The object
oi - The ObjectInspector
Returns:
true if the object passed is representing NULL object false otherwise


Copyright © 2014 The Apache Software Foundation. All rights reserved.