Skip to content

Conversation

@danielclow
Copy link
Contributor

update existing docs and add native subscription

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @danielclow, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances and reorganizes the English documentation for TDengine's data subscription feature. It introduces new, detailed guides for native subscription capabilities, covering everything from topic definition and consumer management to advanced features like data replay. The changes aim to provide clearer, more structured, and comprehensive information for users looking to leverage TDengine's built-in message queue-like functionalities, simplifying application design by reducing the need for external message queue systems.

Highlights

  • New Native Subscription Documentation: Comprehensive guides for TDengine's native data subscription feature have been added, detailing topic creation (query, supertable, database topics), consumer management, and data consumption workflows, including offset handling and replay capabilities.
  • Documentation Restructuring: The existing data subscription documentation has been reorganized. General concepts previously in the index.md file are now in a dedicated 01-topic.md file, and a new 02-native.md file specifically covers native subscription implementation details.
  • Link Updates: Internal links across various documentation files (03-intro.md, 07-tmq.md, 10-taosbenchmark.md) have been updated to point to the new, reorganized data subscription documentation paths.
  • File Renaming: The MQTT subscription documentation file was renamed from 01-mqtt.md to 03-mqtt.md, indicating a reordering within the 01-subscription directory.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation for data subscriptions, including restructuring the files and adding new content for topics and native subscriptions. The changes are well-organized and improve the documentation structure. I've provided a few minor suggestions to fix typos and improve consistency in the new markdown files.

Comment on lines 33 to 36
1. Once this type of TOPIC is created, the structure of the subscribed data is fixed.
1. Columns or tags that are subscribed to or referenced in calculations cannot be deleted (`ALTER TABLE DROP`) or modified (`ALTER TABLE MODIFY`).
1. If the table schema changes, any newly added columns will not appear in the subscription result.
1. For SELECT \*, the subscription expands to include all columns present at creation time. For subtables and normal tables, these are data columns; for supertables, they include both data and tag columns.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and better readability of the markdown source, TOPIC on line 33 should be in lowercase as topic. Additionally, it's recommended to use sequential numbers for ordered lists.

Suggested change
1. Once this type of TOPIC is created, the structure of the subscribed data is fixed.
1. Columns or tags that are subscribed to or referenced in calculations cannot be deleted (`ALTER TABLE DROP`) or modified (`ALTER TABLE MODIFY`).
1. If the table schema changes, any newly added columns will not appear in the subscription result.
1. For SELECT \*, the subscription expands to include all columns present at creation time. For subtables and normal tables, these are data columns; for supertables, they include both data and tag columns.
1. Once this type of topic is created, the structure of the subscribed data is fixed.
2. Columns or tags that are subscribed to or referenced in calculations cannot be deleted (`ALTER TABLE DROP`) or modified (`ALTER TABLE MODIFY`).
3. If the table schema changes, any newly added columns will not appear in the subscription result.
4. For SELECT \*, the subscription expands to include all columns present at creation time. For subtables and normal tables, these are data columns; for supertables, they include both data and tag columns.
Comment on lines +54 to +61
1. Schema changes are not restricted. Any structural changes to the supertable, as well as new data inserted afterward, will continue to be included in the subscription.
1. The returned data is unstructured, and its schema dynamically adapts to changes in the supertable definition.
1. The optional `WITH META` parameter allows the subscription to return statements for creating the supertable and its subtables — primarily used by taosX during supertable migration.
1. The optional `WHERE` condition parameter filters the subtables to subscribe to.
- Only tags or tbname can be used in the `WHERE` clause; regular columns are not allowed.
- Functions can be used to filter tags, but aggregate functions are not supported, since subtable tag values cannot be aggregated.
- Constant expressions such as 2 > 1 (subscribe to all subtables) or FALSE (subscribe to none) are also valid.
1. The returned data does not include tag values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability of the markdown source, it's recommended to use sequential numbers for this ordered list.

Suggested change
1. Schema changes are not restricted. Any structural changes to the supertable, as well as new data inserted afterward, will continue to be included in the subscription.
1. The returned data is unstructured, and its schema dynamically adapts to changes in the supertable definition.
1. The optional `WITH META` parameter allows the subscription to return statements for creating the supertable and its subtables — primarily used by taosX during supertable migration.
1. The optional `WHERE` condition parameter filters the subtables to subscribe to.
- Only tags or tbname can be used in the `WHERE` clause; regular columns are not allowed.
- Functions can be used to filter tags, but aggregate functions are not supported, since subtable tag values cannot be aggregated.
- Constant expressions such as 2 > 1 (subscribe to all subtables) or FALSE (subscribe to none) are also valid.
1. The returned data does not include tag values.
1. Schema changes are not restricted. Any structural changes to the supertable, as well as new data inserted afterward, will continue to be included in the subscription.
2. The returned data is unstructured, and its schema dynamically adapts to changes in the supertable definition.
3. The optional `WITH META` parameter allows the subscription to return statements for creating the supertable and its subtables — primarily used by taosX during supertable migration.
4. The optional `WHERE` condition parameter filters the subtables to subscribe to.
- Only tags or tbname can be used in the `WHERE` clause; regular columns are not allowed.
- Functions can be used to filter tags, but aggregate functions are not supported, since subtable tag values cannot be aggregated.
- Constant expressions such as 2 > 1 (subscribe to all subtables) or FALSE (subscribe to none) are also valid.
5. The returned data does not include tag values.
Comment on lines +73 to +74
1. The optional `WITH META` parameter allows the subscription to return metadata statements for creating, deleting, or modifying all supertables, subtables, and regular tables in the database. This is primarily used by taosX for database migration.
1. Supertable and database-level subscriptions are considered advanced subscription modes and are more prone to errors. If you need to use them, please consult technical support in advance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability of the markdown source, it's recommended to use sequential numbers for this ordered list.

Suggested change
1. The optional `WITH META` parameter allows the subscription to return metadata statements for creating, deleting, or modifying all supertables, subtables, and regular tables in the database. This is primarily used by taosX for database migration.
1. Supertable and database-level subscriptions are considered advanced subscription modes and are more prone to errors. If you need to use them, please consult technical support in advance.
1. The optional `WITH META` parameter allows the subscription to return metadata statements for creating, deleting, or modifying all supertables, subtables, and regular tables in the database. This is primarily used by taosX for database migration.
2. Supertable and database-level subscriptions are considered advanced subscription modes and are more prone to errors. If you need to use them, please consult technical support in advance.
Comment on lines +148 to +150
1. The first record will be replayed immediately.
1. The second record will be returned 5 seconds later.
1. The third record will be returned 3 seconds after the second one.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability of the markdown source, it's recommended to use sequential numbers for this ordered list.

Suggested change
1. The first record will be replayed immediately.
1. The second record will be returned 5 seconds later.
1. The third record will be returned 3 seconds after the second one.
1. The first record will be replayed immediately.
2. The second record will be returned 5 seconds later.
3. The third record will be returned 3 seconds after the second one.
The following SQL statement creates a subscription named `topic_meters`. Each record retrieved from this subscription will contain the columns selected by the query `SELECT ts, current, voltage, phase, groupid, location FROM meters`.

```sql
`CREATE TOPIC IF NOT EXISTS topic_meters AS SELECT ts, current, voltage, phase, groupid, location FROM meters`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The SQL statement within the code block is incorrectly enclosed in backticks, which will cause rendering issues. It's also a good practice to terminate SQL statements with a semicolon.

Suggested change
`CREATE TOPIC IF NOT EXISTS topic_meters AS SELECT ts, current, voltage, phase, groupid, location FROM meters`
CREATE TOPIC IF NOT EXISTS topic_meters AS SELECT ts, current, voltage, phase, groupid, location FROM meters;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants