Examples of StructTypeInfo


Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

      case PRIMITIVE:
        oi = PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
          ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory());
        break;
      case STRUCT:
        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
        List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
        List<ObjectInspector> fieldObjectInspectors =
          new ArrayList<ObjectInspector>(fieldTypeInfos.size());
        for (int i = 0; i < fieldTypeInfos.size(); i++) {
          fieldObjectInspectors.add(getStandardObjectInspectorFromTypeInfo(fieldTypeInfos.get(i)));
        }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

      ListObjectInspector listInspector = ObjectInspectorFactory.getStandardListObjectInspector(
        getObjectInspector(listType.getListElementTypeInfo()));
      return listInspector;

    case STRUCT:
      StructTypeInfo structType = (StructTypeInfo) type;
      List<TypeInfo> fieldTypes = structType.getAllStructFieldTypeInfos();

      List<ObjectInspector> fieldInspectors = new ArrayList<ObjectInspector>();
      for (TypeInfo fieldType : fieldTypes) {
        fieldInspectors.add(getObjectInspector(fieldType));
      }

      StructObjectInspector structInspector = ObjectInspectorFactory.getStandardStructObjectInspector(
        structType.getAllStructFieldNames(), fieldInspectors);
      return structInspector;

    default:
      throw new IOException("Unknown field schema type");
    }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

    if (oi == null) {

      LOG.debug("Got asked for OI for {} [{} ]", typeInfo.getCategory(), typeInfo.getTypeName());
      switch (typeInfo.getCategory()) {
      case STRUCT:
        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
        List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
        List<ObjectInspector> fieldObjectInspectors = new ArrayList<ObjectInspector>(fieldTypeInfos.size());
        for (int i = 0; i < fieldTypeInfos.size(); i++) {
          fieldObjectInspectors.add(getStandardObjectInspectorFromTypeInfo(fieldTypeInfos.get(i)));
        }
        oi = new HCatRecordObjectInspector(fieldNames, fieldObjectInspectors);
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

      case PRIMITIVE:
        oi = PrimitiveObjectInspectorFactory.getPrimitiveJavaObjectInspector(
          ((PrimitiveTypeInfo) typeInfo).getPrimitiveCategory());
        break;
      case STRUCT:
        StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
        List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
        List<TypeInfo> fieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
        List<ObjectInspector> fieldObjectInspectors =
          new ArrayList<ObjectInspector>(fieldTypeInfos.size());
        for (int i = 0; i < fieldTypeInfos.size(); i++) {
          fieldObjectInspectors.add(getStandardObjectInspectorFromTypeInfo(fieldTypeInfos.get(i)));
        }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

          createLazyObjectInspector(((ListTypeInfo) typeInfo)
          .getListElementTypeInfo(), separator, separatorIndex + 1,
          nullSequence, escaped, escapeChar), LazyUtils.getSeparator(separator, separatorIndex),
          nullSequence, escaped, escapeChar);
    case STRUCT:
      StructTypeInfo structTypeInfo = (StructTypeInfo) typeInfo;
      List<String> fieldNames = structTypeInfo.getAllStructFieldNames();
      List<TypeInfo> fieldTypeInfos = structTypeInfo
          .getAllStructFieldTypeInfos();
      List<ObjectInspector> fieldObjectInspectors = new ArrayList<ObjectInspector>(
          fieldTypeInfos.size());
      for (int i = 0; i < fieldTypeInfos.size(); i++) {
        fieldObjectInspectors.add(createLazyObjectInspector(fieldTypeInfos
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

    // Column types
    assertEquals(1, aoig.getColumnTypes().size());
    TypeInfo typeInfo = aoig.getColumnTypes().get(0);
    assertEquals(ObjectInspector.Category.STRUCT, typeInfo.getCategory());
    assertTrue(typeInfo instanceof StructTypeInfo);
    StructTypeInfo structTypeInfo = (StructTypeInfo)typeInfo;

    // Check individual elements of subrecord
    ArrayList<String> allStructFieldNames = structTypeInfo.getAllStructFieldNames();
    ArrayList<TypeInfo> allStructFieldTypeInfos = structTypeInfo.getAllStructFieldTypeInfos();
    assertEquals(allStructFieldNames.size(), 3);
    String[] names = new String[]{"int1", "boolean1", "long1"};
    String [] typeInfoStrings = new String [] {"int", "boolean", "bigint"};
    for(int i = 0; i < allStructFieldNames.size(); i++) {
      assertEquals("Fieldname " + allStructFieldNames.get(i) +
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

        r.put(k, v);
      }
      return r;
    }
    case STRUCT: {
      StructTypeInfo stype = (StructTypeInfo) type;
      List<TypeInfo> fieldTypes = stype.getAllStructFieldTypeInfos();
      int size = fieldTypes.size();
      // Create the struct if needed
      ArrayList<Object> r = reuse == null ? new ArrayList<Object>(size)
          : (ArrayList<Object>) reuse;
      assert (r.size() <= size);
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

        cTypes.toString());
  }

  private static ArrayList<? extends Object>[] getTypeMap(
      StructObjectInspector oi) {
    StructTypeInfo t = (StructTypeInfo) TypeInfoUtils
        .getTypeInfoFromObjectInspector(oi);
    ArrayList<String> fnames = t.getAllStructFieldNames();
    ArrayList<TypeInfo> fields = t.getAllStructFieldTypeInfos();
    return new ArrayList<?>[]
    {fnames, fields};
  }
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

        OrcFile.readerOptions(conf).filesystem(localFs));
    assertTrue(reader.getNumberOfRows() == rownum);
    assertEquals(reader.getCompression(), CompressionKind.ZLIB);
    StructObjectInspector soi =
        (StructObjectInspector)reader.getObjectInspector();
    StructTypeInfo ti =
        (StructTypeInfo)TypeInfoUtils.getTypeInfoFromObjectInspector(soi);
    assertEquals(((PrimitiveTypeInfo)ti.getAllStructFieldTypeInfos().get(0))
        .getPrimitiveCategory(),
        PrimitiveObjectInspector.PrimitiveCategory.INT);
    assertEquals(((PrimitiveTypeInfo)ti.getAllStructFieldTypeInfos().get(1))
        .getPrimitiveCategory(),
        PrimitiveObjectInspector.PrimitiveCategory.STRING);
   
    RecordReader rows = reader.rows();
    Object row = rows.next(null);
View Full Code Here

Examples of org.apache.hadoop.hive.serde2.typeinfo.StructTypeInfo

  @SuppressWarnings({"unchecked"})

  private static ArrayList<? extends Object>[] getTypeMap(
      StructObjectInspector oi) {
    StructTypeInfo t = (StructTypeInfo) TypeInfoUtils
        .getTypeInfoFromObjectInspector(oi);
    ArrayList<String> fnames = t.getAllStructFieldNames();
    ArrayList<TypeInfo> fields = t.getAllStructFieldTypeInfos();
    return new ArrayList<?>[] {fnames, fields};
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.