public static <T> Write<T> write(String jdbcUrl, String table) {
    return new AutoValue_ClickHouseIO_Write.Builder<T>()
        .jdbcUrl(jdbcUrl)
        .table(table)
        .properties(new Properties())
        .maxInsertBlockSize(DEFAULT_MAX_INSERT_BLOCK_SIZE)
        .initialBackoff(DEFAULT_INITIAL_BACKOFF)
        .maxRetries(DEFAULT_MAX_RETRIES)
        .maxCumulativeBackoff(DEFAULT_MAX_CUMULATIVE_BACKOFF)
        .build()
        .withInsertDeduplicate(true)
        .withInsertDistributedSync(true);
  }
@Test
  public void testComplexTupleType() throws Exception {
    Schema sizeSchema =
        Schema.of(
            Schema.Field.of("width", FieldType.INT64.withNullable(true)),
            Schema.Field.of("height", FieldType.INT64.withNullable(true)));

    Schema browserSchema =
        Schema.of(
            Schema.Field.of("name", FieldType.STRING.withNullable(true)),
            Schema.Field.of("size", FieldType.row(sizeSchema)),
            Schema.Field.of("version", FieldType.STRING.withNullable(true)));

    Schema propSchema =
        Schema.of(
            Schema.Field.of("browser", FieldType.row(browserSchema)),
            Schema.Field.of("deviceCategory", FieldType.STRING.withNullable(true)));

    Schema schema = Schema.of(Schema.Field.of("prop", FieldType.row(propSchema)));

    Row sizeRow = Row.withSchema(sizeSchema).addValue(10L).addValue(20L).build();
    Row browserRow =
        Row.withSchema(browserSchema).addValue("test").addValue(sizeRow).addValue("1.0.0").build();
    Row propRow = Row.withSchema(propSchema).addValue(browserRow).addValue("mobile").build();
    Row row1 = Row.withSchema(schema).addValue(propRow).build();

    executeSql(
        "CREATE TABLE test_named_complex_tuples ("
            + "`prop` Tuple(`browser` Tuple(`name` Nullable(String),`size` Tuple(`width` Nullable(Int64), `height` Nullable(Int64)),`version` Nullable(String)),`deviceCategory` Nullable(String))"
            + ") ENGINE=Log");

    pipeline.apply(Create.of(row1).withRowSchema(schema)).apply(write("test_named_complex_tuples"));

    pipeline.run().waitUntilFinish();

    try (ResultSet rs = executeQuery("SELECT * FROM test_named_complex_tuples")) {
      rs.next();
      assertEquals("[[test, [10, 20], 1.0.0], mobile]", rs.getString("prop"));
    }

    try (ResultSet rs =
        executeQuery(
            "SELECT prop.browser.name as name, prop.browser.size as size FROM test_named_complex_tuples")) {
      rs.next();
      assertEquals("test", rs.getString("name"));
      assertEquals("[10, 20]", rs.getString("size"));
    }
  }