hlteoh37 commented on code in PR #15: URL: https://github.com/apache/flink-connector-aws/pull/15#discussion_r1026723923
########## flink-connector-dynamodb/src/test/java/org/apache/flink/connector/dynamodb/table/DynamoDbDynamicSinkFactoryTest.java: ########## @@ -0,0 +1,267 @@ +package org.apache.flink.connector.dynamodb.table; + +import org.apache.flink.api.connector.sink2.Sink; +import org.apache.flink.connector.dynamodb.sink.DynamoDbSink; +import org.apache.flink.table.api.DataTypes; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.catalog.Column; +import org.apache.flink.table.catalog.ResolvedSchema; +import org.apache.flink.table.connector.ChangelogMode; +import org.apache.flink.table.connector.sink.SinkV2Provider; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.factories.TableOptionsBuilder; +import org.apache.flink.table.factories.TestFormatFactory; +import org.apache.flink.table.runtime.connector.sink.SinkRuntimeProviderContext; + +import org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableMap; + +import org.junit.jupiter.api.Test; + +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import static org.apache.flink.connector.base.table.AsyncSinkConnectorOptions.FLUSH_BUFFER_SIZE; +import static org.apache.flink.connector.base.table.AsyncSinkConnectorOptions.FLUSH_BUFFER_TIMEOUT; +import static org.apache.flink.connector.base.table.AsyncSinkConnectorOptions.MAX_BATCH_SIZE; +import static org.apache.flink.connector.base.table.AsyncSinkConnectorOptions.MAX_BUFFERED_REQUESTS; +import static org.apache.flink.connector.base.table.AsyncSinkConnectorOptions.MAX_IN_FLIGHT_REQUESTS; +import static org.apache.flink.connector.dynamodb.table.DynamoDbConnectorOptions.FAIL_ON_ERROR; +import static org.apache.flink.connector.dynamodb.table.DynamoDbConnectorOptions.TABLE_NAME; +import static org.apache.flink.table.factories.utils.FactoryMocks.createTableSink; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; + +/** Test for {@link DynamoDbDynamicSink} created by {@link DynamoDbDynamicSinkFactory}. */ +public class DynamoDbDynamicSinkFactoryTest { + + private static final String DYNAMO_DB_TABLE_NAME = "TestDynamoDBTable"; + + @Test + void testGoodPartitionedTableSink() { + ResolvedSchema sinkSchema = + ResolvedSchema.of( + Column.physical("partition_key", DataTypes.STRING()), + Column.physical("sort_key", DataTypes.BIGINT()), + Column.physical("payload", DataTypes.STRING()), + Column.physical("some_char_array", DataTypes.ARRAY(DataTypes.CHAR(1))), + Column.physical( + "some_varchar_array", DataTypes.ARRAY(DataTypes.VARCHAR(1))), + Column.physical("some_string_array", DataTypes.ARRAY(DataTypes.STRING())), + Column.physical("some_boolean_array", DataTypes.ARRAY(DataTypes.BOOLEAN())), + Column.physical( + "some_decimal_array", DataTypes.ARRAY(DataTypes.DECIMAL(1, 1))), + Column.physical("some_tinyint_array", DataTypes.ARRAY(DataTypes.TINYINT())), + Column.physical( + "some_smallint_array", DataTypes.ARRAY(DataTypes.SMALLINT())), + Column.physical("some_int_array", DataTypes.ARRAY(DataTypes.INT())), + Column.physical("some_bigint_array", DataTypes.ARRAY(DataTypes.BIGINT())), + Column.physical("some_float_array", DataTypes.ARRAY(DataTypes.FLOAT())), + Column.physical("some_date_array", DataTypes.ARRAY(DataTypes.DATE())), + Column.physical("some_time_array", DataTypes.ARRAY(DataTypes.TIME())), + Column.physical( + "some_timestamp_array", DataTypes.ARRAY(DataTypes.TIMESTAMP())), + Column.physical( + "some_timestamp_ltz_array", + DataTypes.ARRAY(DataTypes.TIMESTAMP_LTZ())), + Column.physical( + "some_map", DataTypes.MAP(DataTypes.STRING(), DataTypes.BIGINT()))); Review Comment: ok done -- 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. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org