Beispiel #1
0
 @Test
 public void test_getOrcField_nested_map() throws Exception {
   final SchemaBuilder.FieldAssembler<Schema> builder =
       SchemaBuilder.record("testRecord").namespace("any.data").fields();
   builder.name("map").type().map().values().map().values().doubleType().noDefault();
   Schema testSchema = builder.endRecord();
   TypeInfo orcType = NiFiOrcUtils.getOrcField(testSchema.getField("map").schema());
   assertEquals(
       TypeInfoFactory.getMapTypeInfo(
           TypeInfoCreator.createString(),
           TypeInfoFactory.getMapTypeInfo(
               TypeInfoCreator.createString(), TypeInfoCreator.createDouble())),
       orcType);
 }
  @Test
  public void testMapColumnPairs() throws TooManyAccumuloColumnsException {
    ColumnMapper columnMapper =
        new ColumnMapper(
            ":rowID,cf:*",
            conf.get(AccumuloSerDeParameters.DEFAULT_STORAGE_TYPE),
            Arrays.asList("row", "col"),
            Arrays.<TypeInfo>asList(
                TypeInfoFactory.stringTypeInfo,
                TypeInfoFactory.getMapTypeInfo(
                    TypeInfoFactory.stringTypeInfo, TypeInfoFactory.stringTypeInfo)));
    Set<Pair<Text, Text>> pairs = inputformat.getPairCollection(columnMapper.getColumnMappings());

    Assert.assertEquals(1, pairs.size());

    Pair<Text, Text> cfCq = pairs.iterator().next();
    Assert.assertEquals("cf", cfCq.getFirst().toString());
    Assert.assertNull(cfCq.getSecond());
  }