You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "xiaochen-zhou (via GitHub)" <gi...@apache.org> on 2026/04/02 07:21:39 UTC
[PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
xiaochen-zhou opened a new pull request, #10698:
URL: https://github.com/apache/seatunnel/pull/10698
### Purpose of this pull request
Optimize HiveDialect metadata query with LIMIT 1
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Exist tests.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on code in PR #10698:
URL: https://github.com/apache/seatunnel/pull/10698#discussion_r3028747777
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/hive/HiveDialect.java:
##########
@@ -68,4 +68,8 @@ public JdbcConnectionProvider getJdbcConnectionProvider(
JdbcConnectionConfig jdbcConnectionConfig) {
return new HiveJdbcConnectionProvider(jdbcConnectionConfig);
}
+
+ private String modifySQLToLimit1(String sql) {
+ return String.format("SELECT * FROM (%s) s LIMIT 1", sql.trim().replaceAll(";$", ""));
Review Comment:
Would it be better to use LIMIT 0 (or add the WHERE 1=0 condition)? Besides, this modification will cause version incompatibility, right? It needs to be explained in the incompatibility document.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10698:
URL: https://github.com/apache/seatunnel/pull/10698#issuecomment-5082504013
I picked this up and refreshed the branch against the current `dev`.
What changed on the latest head:
- Resolved the conflict with the newer Hive partition-metadata changes on `dev` without dropping that upstream behavior.
- Kept the metadata-query optimization for simple Hive SELECT queries by rewriting them to `SELECT * FROM (<query>) s LIMIT 1`.
- Added a compatibility guard for top-level `WITH` / CTE queries, because Hive does not allow `WITH` inside subquery blocks.
- Added focused regression coverage in `HiveDialectTest` for both the simple SELECT rewrite and the top-level CTE no-wrap behavior.
Latest head: `acbb2b969d037ed13b290415d4cf0f774e5cbcd3`.
GitHub CI has been retriggered and is still pending/in progress right now.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10698:
URL: https://github.com/apache/seatunnel/pull/10698#issuecomment-5129182227
Thanks @SEZ9 for the fresh review. I saw the updated `CHANGES_REQUESTED` review on the unchanged Hive metadata-query head.
From Daniel's side, this remains waiting for the contributor to address the latest source review items. Once a new commit is pushed, I am happy to re-review the full diff again against that head.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo commented on PR #10698:
URL: https://github.com/apache/seatunnel/pull/10698#issuecomment-6393946924
Addressed the Hive SQL-rewrite review findings in `232204de1f62` and synchronized with current `dev`.
Metadata discovery now adds a top-level `LIMIT 1` without wrapping the query in a subquery, preserving projection and Hive column qualification. The scan respects quoted literals/identifiers, block and CR/LF line comments, CTE syntax and trailing terminators; existing top-level limits, multiple statements, incomplete syntax and CTE-prefixed data-changing statements remain unchanged.
Twenty exact-output cases replace the reflection-only tests. The existing real Hive integration test now compares column names, labels and JDBC types with the original SQL for ordinary queries, comments, CTEs and existing limits. English and Chinese JDBC documentation describe the metadata-only scope and query-plan limits. A statement `setMaxRows` change alone was avoided because Hive applies that limit in the client result set, rather than rewriting server execution.
Affected JDBC and Hive-IT modules passed Spotless and static diff checks; the final patch received independent internal review. Fresh current-head GitHub CI remains required for runtime validation.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Improve][Connector-V2] Optimize HiveDialect metadata query with LIMIT 1 [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #10698:
URL: https://github.com/apache/seatunnel/pull/10698#issuecomment-5117048437
Quick follow-up after the later review activity: I saw the additional change requests on the Hive metadata-query path.
Because there is no newer commit after those comments yet, I will keep this as waiting for source updates rather than doing another full re-review in this round. Please address the open review points and push an updated head; then I can re-check the complete Hive call chain against the latest code.
The current `Build` check is also failing, but the source review items should be resolved before treating this as a CI-only gate.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org