pratyakshsharma commented on a change in pull request #1597: URL: https://github.com/apache/incubator-hudi/pull/1597#discussion_r422404598
########## File path: hudi-utilities/src/test/java/org/apache/hudi/utilities/TestMultiFormatTimestampBasedKeyGenerator.java ########## @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hudi.utilities; + +import org.apache.avro.Schema; +import org.apache.avro.generic.GenericRecord; +import org.apache.hudi.DataSourceWriteOptions; +import org.apache.hudi.common.model.HoodieKey; +import org.apache.hudi.common.util.SchemaTestUtil; +import org.apache.hudi.common.util.TypedProperties; +import org.apache.hudi.utilities.exception.HoodieDeltaStreamerException; +import org.apache.hudi.utilities.keygen.MultiFormatTimestampBasedKeyGenerator; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; + +import static org.junit.Assert.assertEquals; + +public class TestMultiFormatTimestampBasedKeyGenerator { + private GenericRecord baseRecord; + private TypedProperties properties = new TypedProperties(); + + @Before + public void initialize() throws IOException { + Schema schema = SchemaTestUtil.getTimestampEvolvedSchema(); + baseRecord = SchemaTestUtil + .generateAvroRecordFromJson(schema, 1, "001", "f1"); + + properties.setProperty(DataSourceWriteOptions.RECORDKEY_FIELD_OPT_KEY(), "field1"); + properties.setProperty(DataSourceWriteOptions.PARTITIONPATH_FIELD_OPT_KEY(), "createTime"); + properties.setProperty(DataSourceWriteOptions.HIVE_STYLE_PARTITIONING_OPT_KEY(), "false"); + } + + private TypedProperties getBaseKeyConfig(String timestampType, String inputFormatList, String inputFormatDelimiterRegex, String inputTimezone, String outputFormat, String outputTimezone) { Review comment: Looks like the timestampType is only DATE_STRING in all tests. IMO It would be great if you could cover other timestamp types also :) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
