@Test public void testNoRecordKeyFieldProp() { try { KeyGenerator keyGenerator = new CustomKeyGenerator(getPropsWithoutRecordKeyFieldProps()); keyGenerator.getKey(getRecord()); Assertions.fail("should fail when record key field is not provided!"); } catch (Exception e) { Assertions.assertTrue(e.getMessage().contains("Property hoodie.datasource.write.recordkey.field not found")); } try { KeyGenerator keyGenerator = new CustomKeyGenerator(getPropsWithoutRecordKeyFieldProps()); GenericRecord record = getRecord(); Row row = KeyGeneratorTestUtilities.getRow(record); keyGenerator.getRecordKey(row); Assertions.fail("should fail when record key field is not provided!"); } catch (Exception e) { Assertions.assertTrue(e.getMessage().contains("Property hoodie.datasource.write.recordkey.field not found")); } }
@Override public String getRecordKey(GenericRecord record) { validateRecordKeyFields(); return getRecordKeyFields().size() == 1 ? new SimpleKeyGenerator(config).getRecordKey(record) : new ComplexKeyGenerator(config).getRecordKey(record); }
CustomKeyGenerator extends BuiltinKeyGenerator { @Override public String getRecordKey(GenericRecord record) { validateRecordKeyFields(); return getRecordKeyFields().size() == 1 ? new SimpleKeyGenerator(config).getRecordKey(record) : new ComplexKeyGenerator(config).getRecordKey(record); } }
CustomKeyGenerator extends BuiltinKeyGenerator { @Override public String getRecordKey(GenericRecord record) { validateRecordKeyFields(); return getRecordKeyFields().size() == 1 ? new SimpleKeyGenerator(config).getRecordKey(record) : new ComplexKeyGenerator(config).getRecordKey(record); } CustomKeyGenerator(TypedProperties props); }
CustomKeyGenerator extends BuiltinKeyGenerator { @Override public String getRecordKey(GenericRecord record) { validateRecordKeyFields(); return getRecordKeyFields().size() == 1 ? new SimpleKeyGenerator(config).getRecordKey(record) : new ComplexKeyGenerator(config).getRecordKey(record); } CustomKeyGenerator(TypedProperties props); @Override String getPartitionPath(Row row); @Override String getPartitionPath(GenericRecord record); @Override String getRecordKey(GenericRecord record); @Override String getRecordKey(Row row); }
CustomKeyGenerator extends BuiltinKeyGenerator { @Override public String getRecordKey(GenericRecord record) { validateRecordKeyFields(); return getRecordKeyFields().size() == 1 ? new SimpleKeyGenerator(config).getRecordKey(record) : new ComplexKeyGenerator(config).getRecordKey(record); } CustomKeyGenerator(TypedProperties props); @Override String getPartitionPath(Row row); @Override String getPartitionPath(GenericRecord record); @Override String getRecordKey(GenericRecord record); @Override String getRecordKey(Row row);  }