@Test public void test_ExpectsMatch_MultipleInputFormats_ISO8601NoMsZ_OutputTimezoneAsUTC() throws IOException { baseRecord.put("createTime", "2020-04-01T13:01:33Z"); properties = this.getBaseKeyConfig( "DATE_STRING", "yyyy-MM-dd'T'HH:mm:ssZ,yyyy-MM-dd'T'HH:mm:ss.SSSZ", "", "", "yyyyMMddHH", "UTC"); KeyGenerator keyGen = new TimestampBasedKeyGenerator(properties); HoodieKey hk1 = keyGen.getKey(baseRecord); Assertions.assertEquals("2020040113", hk1.getPartitionPath()); baseRow = genericRecordToRow(baseRecord); assertEquals("2020040113", keyGen.getPartitionPath(baseRow)); }
@Override public String getPartitionPath(GenericRecord record) { Object partitionVal = HoodieAvroUtils.getNestedFieldVal(record, getPartitionPathFields().get(0), true); if (partitionVal == null) { partitionVal = getDefaultPartitionVal(); } try { return getPartitionPath(partitionVal); } catch (Exception e) { throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, e); } }
TimestampBasedKeyGenerator extends SimpleKeyGenerator { @Override public String getPartitionPath(GenericRecord record) { Object partitionVal = HoodieAvroUtils.getNestedFieldVal(record, getPartitionPathFields().get(0), true); if (partitionVal == null) { partitionVal = getDefaultPartitionVal(); } try { return getPartitionPath(partitionVal); } catch (Exception e) { throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, e); } } }
TimestampBasedKeyGenerator extends SimpleKeyGenerator { @Override public String getPartitionPath(GenericRecord record) { Object partitionVal = HoodieAvroUtils.getNestedFieldVal(record, getPartitionPathFields().get(0), true); if (partitionVal == null) { partitionVal = getDefaultPartitionVal(); } try { return getPartitionPath(partitionVal); } catch (Exception e) { throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, e); } } TimestampBasedKeyGenerator(TypedProperties config);   TimestampBasedKeyGenerator(TypedProperties config, String partitionPathField);   TimestampBasedKeyGenerator(TypedProperties config, String recordKeyField, String partitionPathField); }
TimestampBasedKeyGenerator extends SimpleKeyGenerator { @Override public String getPartitionPath(GenericRecord record) { Object partitionVal = HoodieAvroUtils.getNestedFieldVal(record, getPartitionPathFields().get(0), true); if (partitionVal == null) { partitionVal = getDefaultPartitionVal(); } try { return getPartitionPath(partitionVal); } catch (Exception e) { throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, e); } } TimestampBasedKeyGenerator(TypedProperties config);   TimestampBasedKeyGenerator(TypedProperties config, String partitionPathField);   TimestampBasedKeyGenerator(TypedProperties config, String recordKeyField, String partitionPathField); @Override String getPartitionPath(GenericRecord record); @Override String getRecordKey(Row row); @Override String getPartitionPath(Row row); }
TimestampBasedKeyGenerator extends SimpleKeyGenerator { @Override public String getPartitionPath(GenericRecord record) { Object partitionVal = HoodieAvroUtils.getNestedFieldVal(record, getPartitionPathFields().get(0), true); if (partitionVal == null) { partitionVal = getDefaultPartitionVal(); } try { return getPartitionPath(partitionVal); } catch (Exception e) { throw new HoodieDeltaStreamerException("Unable to parse input partition field :" + partitionVal, e); } } TimestampBasedKeyGenerator(TypedProperties config);   TimestampBasedKeyGenerator(TypedProperties config, String partitionPathField);   TimestampBasedKeyGenerator(TypedProperties config, String recordKeyField, String partitionPathField); @Override String getPartitionPath(GenericRecord record); @Override String getRecordKey(Row row); @Override String getPartitionPath(Row row);  }