Esempio n. 1
0
  @Test
  public void test_getPrimitiveOrcTypeFromPrimitiveAvroType() throws Exception {
    // Expected ORC types
    TypeInfo[] expectedTypes = {
      TypeInfoCreator.createInt(),
      TypeInfoCreator.createLong(),
      TypeInfoCreator.createBoolean(),
      TypeInfoCreator.createFloat(),
      TypeInfoCreator.createDouble(),
      TypeInfoCreator.createBinary(),
      TypeInfoCreator.createString(),
    };

    Schema testSchema = buildPrimitiveAvroSchema();
    List<Schema.Field> fields = testSchema.getFields();
    for (int i = 0; i < fields.size(); i++) {
      assertEquals(
          expectedTypes[i],
          NiFiOrcUtils.getPrimitiveOrcTypeFromPrimitiveAvroType(fields.get(i).schema().getType()));
    }
  }
Esempio n. 2
0
 @Test(expected = IllegalArgumentException.class)
 public void test_getPrimitiveOrcTypeFromPrimitiveAvroType_badType() throws Exception {
   Schema.Type nonPrimitiveType = Schema.Type.ARRAY;
   NiFiOrcUtils.getPrimitiveOrcTypeFromPrimitiveAvroType(nonPrimitiveType);
 }