-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Feature][connector-tdengine] Support subtable and fieldNames in tdengine source #9593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| public static final Option<String> FIELD_NAMES = | ||
| Options.key("field_names") | ||
| .stringType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use list type, it's better to write and read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
| .withDescription("The TDengine super table name"); | ||
|
|
||
| public static final Option<String> FIELD_NAMES = | ||
| Options.key("field_names") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Options.key("field_names") | |
| Options.key("read_columns") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
|
|
||
| public static final Option<String> SUB_TABLE = | ||
| Options.key("sub_table") | ||
| .stringType() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks for the effort.
| .withDescription("The upper bound for data query range"); | ||
|
|
||
| public static final Option<String> SUB_TABLE = | ||
| Options.key("sub_table") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Options.key("sub_table") | |
| Options.key("sub_tables") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
51c58dc to
f1816eb
Compare
| database : "power2" | ||
| stable : "meters2" | ||
| timezone: UTC | ||
| write_columns: "ts, voltage, current, power" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @chncaesar . I think we should use list as type same as read_columns.
Hisoka-X
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @chncaesar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for filtering data in TDengine source and sink connectors by introducing new configuration options for subtable selection and column filtering. This addresses issue #9592 by allowing users to specify which subtables to read from and which columns to include/exclude.
- Adds
sub_tablesandread_columnsoptions to TDengine source for filtering data - Adds
write_columnsoption to TDengine sink for column specification - Updates documentation for both source and sink connectors with the new options
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| TDengineSourceOptions.java | Adds new configuration options for subtable and column filtering |
| TDengineSourceConfig.java | Updates config class to handle new filtering options |
| TDengineSinkOptions.java | Adds write_columns option for sink |
| TDengineSinkConfig.java | Updates sink config to handle write_columns |
| TDengineSource.java | Implements filtering logic for subtables and columns |
| TDengineSinkWriter.java | Updates SQL generation to include column specification |
| TDengineSourceReaderTest.java | Adds unit tests for new filtering functionality |
| TDengineIT.java | Adds e2e test for new filtering features |
| Documentation files | Updates English and Chinese docs with new options |
Comments suppressed due to low confidence (4)
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-tdengine-e2e/src/test/resources/tdengine/tdengine_source_to_sink_filter_by_fieldNames.conf:35
- The configuration key 'sub_tables' is inconsistent with the source code which uses 'SUB_TABLES'. This should be 'sub_tables' to match the option key defined in TDengineSourceOptions.
sub_tables: ["d1001","d1002"]
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-tdengine-e2e/src/test/resources/tdengine/tdengine_source_to_sink_filter_by_fieldNames.conf:36
- The configuration key 'read_columns' is inconsistent with the source code which uses 'READ_COLUMNS'. This should be 'read_columns' to match the option key defined in TDengineSourceOptions.
read_columns: ["ts","current","voltage","phase","off","nc","location","groupid"]
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-tdengine-e2e/src/test/resources/tdengine/tdengine_source_to_sink_filter_by_fieldNames.conf:51
- The configuration key 'write_columns' is inconsistent with the source code which uses 'WRITE_COLUMNS'. This should be 'write_columns' to match the option key defined in TDengineSinkOptions.
write_columns: ["ts","current","voltage","phase","off","nc"]
|
@Hisoka-X Could you invite another commiter to review the PR ? thank you. |
Purpose of this pull request
This pr close #9592. It adds two options into source : sub_table and field_names, one option to sink : field_names.
Does this PR introduce any user-facing change?
Yes. New tdengine connector options are added . Users can specify sub_table and field_name when retrieving data from tdengine; and specify field_name when inserting into tdegnine. However, these are optional. Meaning old tdengine source and sink pipelines are not affected by the change, they still work as expected.
The documentation is updated in this PR.
How to use new options to retreive data
The following pipeline retrieves 3 sub tables of super table signal_data, ignoring the rest. And only selects specified fields.
Please note that the tags should always be the last element of field_names, in our case it's signal_id.
How to use new options on the sink side
When specifying field_names on the sink side, please ignore the tag column, "signal_id" in the example. The tdegnine automatically puts the tags column in the insert statement. Here's an example.
How was this patch tested?
Check list
New License Guide