public static ObjectInspector createObjectInspector()

in phoenix5-hive4/src/main/java/org/apache/phoenix/hive/objectinspector/PhoenixObjectInspectorFactory.java [66:147]


    public static ObjectInspector createObjectInspector(TypeInfo type, LazySerDeParameters
            serdeParams) {
        ObjectInspector oi = null;

        if (LOG.isDebugEnabled()) {
            LOG.debug("Type : " + type);
        }

        switch (type.getCategory()) {
            case PRIMITIVE:
                switch (((PrimitiveTypeInfo) type).getPrimitiveCategory()) {
                    case BOOLEAN:
                        oi = new PhoenixBooleanObjectInspector();
                        break;
                    case BYTE:
                        oi = new PhoenixByteObjectInspector();
                        break;
                    case SHORT:
                        oi = new PhoenixShortObjectInspector();
                        break;
                    case INT:
                        oi = new PhoenixIntObjectInspector();
                        break;
                    case LONG:
                        oi = new PhoenixLongObjectInspector();
                        break;
                    case FLOAT:
                        oi = new PhoenixFloatObjectInspector();
                        break;
                    case DOUBLE:
                        oi = new PhoenixDoubleObjectInspector();
                        break;
                    case VARCHAR:
                        // same string
                    case STRING:
                        oi = new PhoenixStringObjectInspector(serdeParams.isEscaped(),
                                serdeParams.getEscapeChar());
                        break;
                    case CHAR:
                        oi = new PhoenixCharObjectInspector((PrimitiveTypeInfo)type);
                        break;
                    case DATE:
                        oi = new PhoenixDateObjectInspector();
                        break;
                    case TIMESTAMP:
                        oi = new PhoenixTimestampObjectInspector();
                        break;
                    case DECIMAL:
                        oi = new PhoenixDecimalObjectInspector((PrimitiveTypeInfo) type);
                        break;
                    case BINARY:
                        oi = new PhoenixBinaryObjectInspector();
                        break;
                    default:
                        throw new RuntimeException("Hive internal error. not supported data type " +
                                ": " + type);
                }

                break;
            case LIST:
                if (LOG.isDebugEnabled()) {
                    LOG.debug("List type started");
                }

                ObjectInspector listElementObjectInspector = createObjectInspector((
                        (ListTypeInfo) type).getListElementTypeInfo(), serdeParams);

                if (LOG.isDebugEnabled()) {
                    LOG.debug("List type ended");
                }

                oi = new PhoenixListObjectInspector(listElementObjectInspector, serdeParams
                        .getSeparators()[0], serdeParams);

                break;
            default:
                throw new RuntimeException("Hive internal error. not supported data type : " +
                        type);
        }

        return oi;
    }