@Test public void testSchemaLiteral() throws IOException { State state = new State(); HiveAvroSerDeManager manager = new HiveAvroSerDeManager(state); HiveRegistrationUnit registrationUnit = (new HiveTable.Builder()).withDbName(TEST_DB).withTableName(TEST_TABLE).build(); manager.addSerDeProperties(this.testBasePath, registrationUnit); Assert.assertTrue(registrationUnit.getSerDeProps().getProp(HiveAvroSerDeManager.SCHEMA_LITERAL).contains("example.avro")); }
@Override public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException { Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory."); Schema schema; try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) { schema = getDirectorySchema(path); } if (schema == null) { return; } hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName()); hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName()); hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName()); addSchemaPropertiesIfRequired(path, hiveUnit, schema); }
HiveAvroSerDeManager extends HiveSerDeManager { @Override public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException { Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory."); Schema schema; try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) { schema = getDirectorySchema(path); } if (schema == null) { return; } hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName()); hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName()); hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName()); addSchemaPropertiesIfRequired(path, hiveUnit, schema); } }
HiveAvroSerDeManager extends HiveSerDeManager { @Override public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException { Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory."); Schema schema; try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) { schema = getDirectorySchema(path); } if (schema == null) { return; } hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName()); hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName()); hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName()); addSchemaPropertiesIfRequired(path, hiveUnit, schema); } HiveAvroSerDeManager(State props); }
HiveAvroSerDeManager extends HiveSerDeManager { @Override public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException { Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory."); Schema schema; try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) { schema = getDirectorySchema(path); } if (schema == null) { return; } hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName()); hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName()); hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName()); addSchemaPropertiesIfRequired(path, hiveUnit, schema); } HiveAvroSerDeManager(State props); @Override void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit); @Override void addSerDeProperties(HiveRegistrationUnit source, HiveRegistrationUnit target); @Override void updateSchema(HiveRegistrationUnit existingUnit, HiveRegistrationUnit newUnit); @Override boolean haveSameSchema(HiveRegistrationUnit unit1, HiveRegistrationUnit unit2); }
HiveAvroSerDeManager extends HiveSerDeManager { @Override public void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit) throws IOException { Preconditions.checkArgument(this.fs.getFileStatus(path).isDirectory(), path + " is not a directory."); Schema schema; try (Timer.Context context = metricContext.timer(HIVE_SPEC_SCHEMA_READING_TIMER).time()) { schema = getDirectorySchema(path); } if (schema == null) { return; } hiveUnit.setSerDeType(this.serDeWrapper.getSerDe().getClass().getName()); hiveUnit.setInputFormat(this.serDeWrapper.getInputFormatClassName()); hiveUnit.setOutputFormat(this.serDeWrapper.getOutputFormatClassName()); addSchemaPropertiesIfRequired(path, hiveUnit, schema); } HiveAvroSerDeManager(State props); @Override void addSerDeProperties(Path path, HiveRegistrationUnit hiveUnit); @Override void addSerDeProperties(HiveRegistrationUnit source, HiveRegistrationUnit target); @Override void updateSchema(HiveRegistrationUnit existingUnit, HiveRegistrationUnit newUnit); @Override boolean haveSameSchema(HiveRegistrationUnit unit1, HiveRegistrationUnit unit2); static final String SCHEMA_LITERAL; static final String SCHEMA_URL; static final String USE_SCHEMA_FILE; static final boolean DEFAULT_USE_SCHEMA_FILE; static final String SCHEMA_FILE_NAME; static final String DEFAULT_SCHEMA_FILE_NAME; static final String SCHEMA_TEMP_FILE_NAME; static final String DEFAULT_SCHEMA_TEMP_FILE_NAME; static final String USE_SCHEMA_TEMP_FILE; static final boolean DEFAULT_USE_SCHEMA_TEMP_FILE; static final String SCHEMA_LITERAL_LENGTH_LIMIT; static final int DEFAULT_SCHEMA_LITERAL_LENGTH_LIMIT; static final String HIVE_SPEC_SCHEMA_READING_TIMER; static final String HIVE_SPEC_SCHEMA_WRITING_TIMER; }