Examples of UnionTypeInfo


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

            .getLazyBinaryStructObjectInspector(fieldNames,
            fieldObjectInspectors);
        break;
      }
      case UNION: {
        UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
        final List<TypeInfo> fieldTypeInfos = unionTypeInfo.getAllUnionObjectTypeInfos();
        List<ObjectInspector> fieldObjectInspectors = new ArrayList<ObjectInspector>(
          fieldTypeInfos.size());
        for (int i = 0; i < fieldTypeInfos.size(); i++) {
          fieldObjectInspectors
            .add(getLazyBinaryObjectInspectorFromTypeInfo(fieldTypeInfos
View Full Code Here

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

          fieldNames, fieldObjectInspectors,
          LazyUtils.getSeparator(separator, separatorIndex),
nullSequence,
          false, escaped, escapeChar, option);
    case UNION:
      UnionTypeInfo unionTypeInfo = (UnionTypeInfo) typeInfo;
      List<ObjectInspector> lazyOIs = new ArrayList<ObjectInspector>();
      for (TypeInfo uti : unionTypeInfo.getAllUnionObjectTypeInfos()) {
        lazyOIs.add(createLazyObjectInspector(uti, separator,
            separatorIndex + 1, nullSequence, escaped,
            escapeChar, extendedBooleanLiteral, option));
      }
      return LazyObjectInspectorFactory.getLazyUnionObjectInspector(lazyOIs,
View Full Code Here

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

        ListTypeInfo ati = (ListTypeInfo)ti;
        result = ObjectInspectorFactory
                .getStandardListObjectInspector(createObjectInspectorWorker(ati.getListElementTypeInfo()));
        break;
      case UNION:
        UnionTypeInfo uti = (UnionTypeInfo)ti;
        List<TypeInfo> allUnionObjectTypeInfos = uti.getAllUnionObjectTypeInfos();
        List<ObjectInspector> unionObjectInspectors = new ArrayList<ObjectInspector>(allUnionObjectTypeInfos.size());

        for (TypeInfo typeInfo : allUnionObjectTypeInfos) {
          unionObjectInspectors.add(createObjectInspectorWorker(typeInfo));
        }
View Full Code Here

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

            .get(eid)));
      }
      return r;
    }
    case UNION: {
      UnionTypeInfo utype = (UnionTypeInfo) type;
      StandardUnion r = reuse == null ? new StandardUnion()
          : (StandardUnion) reuse;
      // Read the tag
      byte tag = buffer.read(invert);
      r.setTag(tag);
      r.setObject(deserialize(buffer, utype.getAllUnionObjectTypeInfos().get(tag),
          invert, null));
      return r;
    }
    default: {
      throw new RuntimeException("Unrecognized type: " + type.getCategory());
View Full Code Here

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

    // Column types
    assertEquals(1, aoig.getColumnTypes().size());
    TypeInfo typeInfo = aoig.getColumnTypes().get(0);
    assertTrue(typeInfo instanceof UnionTypeInfo);
    UnionTypeInfo uti = (UnionTypeInfo)typeInfo;

    // Check that the union has come out unscathed. No scathing of unions allowed.
    List<TypeInfo> typeInfos = uti.getAllUnionObjectTypeInfos();
    assertEquals(2, typeInfos.size());
    assertEquals(INT, typeInfos.get(0));
    assertEquals(STRING, typeInfos.get(1));
    assertEquals("uniontype<int,string>", uti.getTypeName());
  }
View Full Code Here

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

        expectedSchema, getAvroSchemaString(mapTypeInfo));
  }

  @Test
  public void createAvroUnionSchema() {
    UnionTypeInfo unionTypeInfo = new UnionTypeInfo();
    unionTypeInfo.setAllUnionObjectTypeInfos(Arrays.asList(INT, FLOAT, STRING));

    final String specificSchema = Schema.createUnion(
        Arrays.asList(
            Schema.create(Schema.Type.NULL),
            Schema.create(Schema.Type.INT),
View Full Code Here

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

        expectedSchema, getAvroSchemaString(unionTypeInfo));
  }

  @Test
  public void createAvroUnionSchemaOfNull() {
    UnionTypeInfo unionTypeInfo = new UnionTypeInfo();
    unionTypeInfo.setAllUnionObjectTypeInfos(Arrays.asList(VOID));

    final String specificSchema = Schema.createUnion(
        Arrays.asList(
            Schema.create(Schema.Type.NULL))).toString();
    String expectedSchema = genSchemaWithoutNull(specificSchema);
View Full Code Here

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

        expectedSchema, getAvroSchemaString(unionTypeInfo));
  }

  @Test
  public void createAvroUnionSchemaOfOne() {
    UnionTypeInfo unionTypeInfo = new UnionTypeInfo();
    unionTypeInfo.setAllUnionObjectTypeInfos(Arrays.asList(STRING));

    final String specificSchema = Schema.createUnion(
        Arrays.asList(
            Schema.create(Schema.Type.NULL),
            Schema.create(Schema.Type.STRING))).toString();
View Full Code Here

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

        expectedSchema, getAvroSchemaString(unionTypeInfo));
  }

  @Test
  public void createAvroUnionSchemaWithNull() {
    UnionTypeInfo unionTypeInfo = new UnionTypeInfo();
    unionTypeInfo.setAllUnionObjectTypeInfos(Arrays.asList(INT, FLOAT, STRING, VOID));

    final String specificSchema = Schema.createUnion(
        Arrays.asList(
            Schema.create(Schema.Type.NULL),
            Schema.create(Schema.Type.INT),
View Full Code Here

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

            .get(eid)));
      }
      return r;
    }
    case UNION: {
      UnionTypeInfo utype = (UnionTypeInfo) type;
      StandardUnion r = reuse == null ? new StandardUnion()
          : (StandardUnion) reuse;
      // Read the tag
      byte tag = buffer.read(invert);
      r.setTag(tag);
      r.setObject(deserialize(buffer, utype.getAllUnionObjectTypeInfos().get(tag),
          invert, null));
      return r;
    }
    default: {
      throw new RuntimeException("Unrecognized type: " + type.getCategory());
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.