You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "xiasongh (via GitHub)" <gi...@apache.org> on 2024/10/13 21:29:02 UTC

[PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

xiasongh opened a new pull request, #11313:
URL: https://github.com/apache/iceberg/pull/11313

   Add a new config `iceberg.tables.route-pattern` to dynamically route to Iceberg tables using Kafka topic name
   
   Closes #11163


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "bryanck (via GitHub)" <gi...@apache.org>.
bryanck commented on code in PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#discussion_r1803548713


##########
docs/docs/kafka-connect.md:
##########
@@ -63,6 +63,7 @@ for exactly-once semantics. This requires Kafka 2.5 or later.
 | iceberg.tables                             | Comma-separated list of destination tables                                                                       |
 | iceberg.tables.dynamic-enabled             | Set to `true` to route to a table specified in `routeField` instead of using `routeRegex`, default is `false`    |
 | iceberg.tables.route-field                 | For multi-table fan-out, the name of the field used to route records to tables                                   |
+| iceberg.tables.route-pattern               | For topic-based routing, the format string used to route records to tables, e.g. `db.{topic}`

Review Comment:
   I feel we should reuse `iceberg.tables.route-field` and have that support the expression syntax.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2623223008

   This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2638321108

   This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "bryanck (via GitHub)" <gi...@apache.org>.
bryanck commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2417500473

   Thanks for the PR @xiasongh ! I'm interested in your thoughts on using a single property to define routing. If you agree, I can re-review once you make that change.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "bryanck (via GitHub)" <gi...@apache.org>.
bryanck commented on code in PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#discussion_r1803549096


##########
docs/docs/kafka-connect.md:
##########
@@ -87,8 +88,8 @@ for exactly-once semantics. This requires Kafka 2.5 or later.
 | iceberg.kafka.*                            | Properties passed through to control topic Kafka client initialization                                           |
 
 If `iceberg.tables.dynamic-enabled` is `false` (the default) then you must specify `iceberg.tables`. If
-`iceberg.tables.dynamic-enabled` is `true` then you must specify `iceberg.tables.route-field` which will
-contain the name of the table.
+`iceberg.tables.dynamic-enabled` is `true` then you must specify either `iceberg.tables.route-field` which will
+contain the name of the table or `iceberg.tables.route-pattern` which specifies a format string for the table.

Review Comment:
   If we go with a single property we can revert this



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "xiasongh (via GitHub)" <gi...@apache.org>.
xiasongh commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2427381877

   > Thanks for the PR @xiasongh ! I'm interested in your thoughts on using a single property to define routing. If you agree, I can re-review once you make that change.
   
   Hi @bryanck, thanks for the review!
   
   I'm a little apprehensive about re-using `iceberg.tables.route-field` since the semantics would be inconsistent.
   
   `iceberg.tables.route-field` is used to point at a field in the record and use its value as the target iceberg table, whereas `iceberg.tables.route-pattern` is used as a format string that results in the table. I think mixing the two as it is now would be a bit confusing.
   
   For example, if we had `iceberg.tables.route-field = "{topic}"`, does that mean the target table is the value of the `{topic}` field or is the target table `{topic}`? Is the rule: if there's a format string, then it's the target table, otherwise it's a field that contains the target table?
   
   How about we introduce `iceberg.tables.route-pattern` and support adding fields from the record using the expression syntax? For example, `iceberg.tables.route-pattern="{field}"` would be equivalent to `iceberg.tables.route-field="field"`, but something like `iceberg.tables.route-pattern="db.{_topic}_{field}"` would also be supported. Thoughts?


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "xiasongh (via GitHub)" <gi...@apache.org>.
xiasongh commented on code in PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#discussion_r1798594599


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SinkWriter.java:
##########
@@ -133,6 +145,20 @@ private String extractRouteValue(Object recordValue, String routeField) {
     return routeValue == null ? null : routeValue.toString();
   }
 
+  private String formatRoutePattern(SinkRecord record, String routePattern) {
+    if (routePattern == null) {
+      return null;
+    }
+
+    String topicName = record.topic();
+    if (topicName == null) {
+      return null;
+    }
+
+    // replace topic namespace separator
+    return routePattern.replace("{topic}", topicName.replace(".", "_"));

Review Comment:
   > topicName.replace(".", "_")
   I use AWS Glue catalog, which doesn't support nested namespaces. Topic names with more than 1 `.` would be invalid table names
   
   The Debezium JDBC sink connector [0] also does this, so it's not totally unheard of
   
   It probably makes most sense to turn this into it's own config, maybe something like `iceberg.tables.route-pattern.namespace-separator`?
   
   [0] https://debezium.io/documentation/reference/stable/connectors/jdbc.html#jdbc-property-table-naming-strategy
   
   



##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SinkWriter.java:
##########
@@ -133,6 +145,20 @@ private String extractRouteValue(Object recordValue, String routeField) {
     return routeValue == null ? null : routeValue.toString();
   }
 
+  private String formatRoutePattern(SinkRecord record, String routePattern) {
+    if (routePattern == null) {
+      return null;
+    }
+
+    String topicName = record.topic();
+    if (topicName == null) {
+      return null;
+    }
+
+    // replace topic namespace separator
+    return routePattern.replace("{topic}", topicName.replace(".", "_"));

Review Comment:
   > topicName.replace(".", "_")
   
   I use AWS Glue catalog, which doesn't support nested namespaces. Topic names with more than 1 `.` would be invalid table names
   
   The Debezium JDBC sink connector [0] also does this, so it's not totally unheard of
   
   It probably makes most sense to turn this into it's own config, maybe something like `iceberg.tables.route-pattern.namespace-separator`?
   
   [0] https://debezium.io/documentation/reference/stable/connectors/jdbc.html#jdbc-property-table-naming-strategy
   
   



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #11313: Kafka Connect: Add config to route to tables using topic name
URL: https://github.com/apache/iceberg/pull/11313


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "xiasongh (via GitHub)" <gi...@apache.org>.
xiasongh commented on code in PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#discussion_r1798594599


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SinkWriter.java:
##########
@@ -133,6 +145,20 @@ private String extractRouteValue(Object recordValue, String routeField) {
     return routeValue == null ? null : routeValue.toString();
   }
 
+  private String formatRoutePattern(SinkRecord record, String routePattern) {
+    if (routePattern == null) {
+      return null;
+    }
+
+    String topicName = record.topic();
+    if (topicName == null) {
+      return null;
+    }
+
+    // replace topic namespace separator
+    return routePattern.replace("{topic}", topicName.replace(".", "_"));

Review Comment:
   > topicName.replace(".", "_")
   
   I use AWS Glue catalog, which doesn't support nested namespaces. Topic names with more than 1 `.` would be invalid table names, so one thing we can do is replace all the `.` characters
   
   The Debezium JDBC sink connector [0] also does this, so it's not totally unheard of
   
   It probably makes most sense to turn this into it's own config, maybe something like `iceberg.tables.route-pattern.namespace-separator`? Thoughts?
   
   [0] https://debezium.io/documentation/reference/stable/connectors/jdbc.html#jdbc-property-table-naming-strategy
   
   



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "xiasongh (via GitHub)" <gi...@apache.org>.
xiasongh commented on code in PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#discussion_r1798594599


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/SinkWriter.java:
##########
@@ -133,6 +145,20 @@ private String extractRouteValue(Object recordValue, String routeField) {
     return routeValue == null ? null : routeValue.toString();
   }
 
+  private String formatRoutePattern(SinkRecord record, String routePattern) {
+    if (routePattern == null) {
+      return null;
+    }
+
+    String topicName = record.topic();
+    if (topicName == null) {
+      return null;
+    }
+
+    // replace topic namespace separator
+    return routePattern.replace("{topic}", topicName.replace(".", "_"));

Review Comment:
   > topicName.replace(".", "_")
   
   I use AWS Glue catalog, which doesn't support nested namespaces. Topic names with more than 1 `.` would be invalid table names, so one thing we can do is replace all the `.` characters
   
   The Debezium JDBC sink connector [0] also does this, so it's not totally unheard of
   
   It probably makes most sense to turn this into it's own config, maybe something like `iceberg.tables.route-pattern.namespace-separator`?
   
   [0] https://debezium.io/documentation/reference/stable/connectors/jdbc.html#jdbc-property-table-naming-strategy
   
   



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "mun1r0b0t (via GitHub)" <gi...@apache.org>.
mun1r0b0t commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2484098247

   Hi folks, is this still being worked on? 
   
   I have a similar need to route by topic, but the changes in this PR will not address my needs. I need to configure the topic for individual tables and cannot use the topic name as the table name. I would like to submit a separate PR for your review.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "mun1r0b0t (via GitHub)" <gi...@apache.org>.
mun1r0b0t commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2492647778

   I opened up https://github.com/apache/iceberg/issues/11163 since I did not hear back on this.
   


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "xiasongh (via GitHub)" <gi...@apache.org>.
xiasongh commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2564847217

   Hey @bryanck @mun1r0b0t!
   
   Sorry! I've been a bit busy and this PR got lost.
   
   I can finish up this PR, but I'd like to get some thoughts on my previous comment so I can make sure I'm making a change we agree on.
   
   To give context since it's been a while, I'd like to keep the new dynamic routing config `route-pattern` distinct as I believe it's semantically different than `route-field`.
   
   I'm fine with putting the functionality into `route-field`, but I would like some clarification on what the semantics should be.
   
   I give some more details in this comment: https://github.com/apache/iceberg/pull/11313#issuecomment-2427381877
   
   Thanks!


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Kafka Connect: Add config to route to tables using topic name [iceberg]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11313:
URL: https://github.com/apache/iceberg/pull/11313#issuecomment-2558674264

   This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.


-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org