org.apache.hadoop.hive.serde2.objectinspector.UnionObject Java Examples

The following examples show how to use org.apache.hadoop.hive.serde2.objectinspector.UnionObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnionField.java    From multiple-dimension-spread with Apache License 2.0 5 votes vote down vote up
@Override
public UnionObject get( final ColumnAndIndex columnAndIndex ){
  try{
    return new StandardUnion( tag , PrimitiveToWritableConverter.convert( inspector.getPrimitiveCategory() , columnAndIndex.column.get( columnAndIndex.index ) ) );
  }catch( IOException e ){
    return null;
  }
}
 
Example #2
Source File: UnionField.java    From multiple-dimension-spread with Apache License 2.0 5 votes vote down vote up
public UnionObject get( final ColumnAndIndex columnAndIndex ){
  IGetUnionObject field = columnTypeMap.get( columnAndIndex.column.get( columnAndIndex.index ).getType() );
  if( field == null ){
    return null;
  }
  return field.get( columnAndIndex );
}
 
Example #3
Source File: TestNiFiOrcUtils.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Test
public void test_convertToORCObject() {
    List<Object> objects = Arrays.asList("Hello", "x");
    objects.forEach((avroObject) -> {
        Object o = NiFiOrcUtils.convertToORCObject(TypeInfoUtils.getTypeInfoFromTypeString("uniontype<bigint,string>"), avroObject, true);
        assertTrue(o instanceof UnionObject);
        UnionObject uo = (UnionObject) o;
        assertTrue(uo.getObject() instanceof Text);
    });
}
 
Example #4
Source File: TestNiFiOrcUtils.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Test
public void test_convertToORCObject() {
    Schema schema = SchemaBuilder.enumeration("myEnum").symbols("x", "y", "z");
    List<Object> objects = Arrays.asList(new Utf8("Hello"), new GenericData.EnumSymbol(schema, "x"));
    objects.forEach((avroObject) -> {
        Object o = NiFiOrcUtils.convertToORCObject(TypeInfoUtils.getTypeInfoFromTypeString("uniontype<bigint,string>"), avroObject);
        assertTrue(o instanceof UnionObject);
        UnionObject uo = (UnionObject) o;
        assertTrue(uo.getObject() instanceof Text);
    });
}
 
Example #5
Source File: UnionField.java    From multiple-dimension-spread with Apache License 2.0 4 votes vote down vote up
@Override
public UnionObject get( final ColumnAndIndex columnAndIndex ){
  return new StandardUnion( tag , columnAndIndex );
}
 
Example #6
Source File: UnionField.java    From multiple-dimension-spread with Apache License 2.0 4 votes vote down vote up
@Override
public UnionObject get( final ColumnAndIndex columnAndIndex ){
  return null;
}
 
Example #7
Source File: UnionField.java    From multiple-dimension-spread with Apache License 2.0 votes vote down vote up
public UnionObject get( final ColumnAndIndex columnAndIndex );