This is an automated email from the ASF dual-hosted git repository.
davidzollo pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 943cedb48b [Fix][Connector-V2] Parse ClickhouseFile node_pass with
documented snake_case keys (#11525)
943cedb48b is described below
commit 943cedb48bf2cbe6ec8367b14c3ab169926e984f
Author: Jast <[email protected]>
AuthorDate: Sat Jul 25 20:43:04 2026 +0800
[Fix][Connector-V2] Parse ClickhouseFile node_pass with documented
snake_case keys (#11525)
---
.../clickhouse/config/NodePassConfig.java | 13 ++++
.../clickhouse/config/NodePassConfigTest.java | 75 ++++++++++++++++++++++
2 files changed, 88 insertions(+)
diff --git
a/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfig.java
b/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfig.java
index 47c66cc4fe..6cc79e7b7b 100644
---
a/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfig.java
+++
b/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfig.java
@@ -17,6 +17,9 @@
package org.apache.seatunnel.connectors.seatunnel.clickhouse.config;
+import org.apache.seatunnel.shade.com.fasterxml.jackson.annotation.JsonAlias;
+import
org.apache.seatunnel.shade.com.fasterxml.jackson.annotation.JsonProperty;
+
import org.apache.seatunnel.api.configuration.util.OptionMark;
import lombok.Data;
@@ -24,9 +27,19 @@ import lombok.Data;
@Data
public class NodePassConfig {
+ // The documented config key is snake_case ("node_pass.node_address"),
while
+ // ReadonlyConfig converts the value with a plain ObjectMapper that has no
+ // snake_case naming strategy. Without the explicit mapping the conversion
+ // fails with an UnrecognizedPropertyException and the sink cannot be
+ // created (issue #9889).
@OptionMark(description = "The address of Clickhouse server node")
+ @JsonProperty("node_address")
+ @JsonAlias("nodeAddress")
private String nodeAddress;
+ @OptionMark(description = "Clickhouse server linux username")
+ private String username;
+
@OptionMark(description = "Clickhouse server linux password")
private String password;
}
diff --git
a/seatunnel-connectors-v2/connector-clickhouse/src/test/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfigTest.java
b/seatunnel-connectors-v2/connector-clickhouse/src/test/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfigTest.java
new file mode 100644
index 0000000000..5f59a61214
--- /dev/null
+++
b/seatunnel-connectors-v2/connector-clickhouse/src/test/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/config/NodePassConfigTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.clickhouse.config;
+
+import org.apache.seatunnel.api.configuration.ReadonlyConfig;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class NodePassConfigTest {
+
+ @Test
+ public void testNodePassConfigParsesDocumentedSnakeCaseKeys() {
+ // The documented node_pass entries use snake_case keys
+ // (node_pass.node_address / node_pass.username / node_pass.password).
+ // ReadonlyConfig.get(NODE_PASS) must convert them into NodePassConfig;
+ // before the fix the plain ObjectMapper conversion failed with
+ // UnrecognizedPropertyException and the sink could not be created
+ // (issue #9889).
+ Map<String, Object> nodePass = new HashMap<>();
+ nodePass.put("node_address", "10.0.0.1:8123");
+ nodePass.put("username", "default");
+ nodePass.put("password", "secret");
+
+ ReadonlyConfig config =
+ ReadonlyConfig.fromMap(
+ Collections.singletonMap(
+ ClickhouseFileSinkOptions.NODE_PASS.key(),
+ Collections.singletonList(nodePass)));
+
+ List<NodePassConfig> parsed =
config.get(ClickhouseFileSinkOptions.NODE_PASS);
+ Assertions.assertEquals(1, parsed.size());
+ Assertions.assertEquals("10.0.0.1:8123",
parsed.get(0).getNodeAddress());
+ Assertions.assertEquals("default", parsed.get(0).getUsername());
+ Assertions.assertEquals("secret", parsed.get(0).getPassword());
+ }
+
+ @Test
+ public void testNodePassConfigAcceptsCamelCaseAlias() {
+ Map<String, Object> nodePass = new HashMap<>();
+ nodePass.put("nodeAddress", "10.0.0.2:8123");
+ nodePass.put("password", "secret2");
+
+ ReadonlyConfig config =
+ ReadonlyConfig.fromMap(
+ Collections.singletonMap(
+ ClickhouseFileSinkOptions.NODE_PASS.key(),
+ Collections.singletonList(nodePass)));
+
+ List<NodePassConfig> parsed =
config.get(ClickhouseFileSinkOptions.NODE_PASS);
+ Assertions.assertEquals(1, parsed.size());
+ Assertions.assertEquals("10.0.0.2:8123",
parsed.get(0).getNodeAddress());
+ Assertions.assertEquals("secret2", parsed.get(0).getPassword());
+ }
+}