dragonknightk opened a new pull request, #13373:
URL: https://github.com/apache/seatunnel/pull/13373

   ### Purpose of this pull request
   
   Yes, I am contributing to Apache SeaTunnel.
   
   The Doris source fails to read a table when a read field is a Doris keyword 
such as `from`, `desc`, `to` or `system`. The source builds a `select` 
statement for the FE query plan API and joins the read fields without quoting 
them. Doris FE then rejects the statement with a parse error. The 
`doris.read.field` option has no way to pass quoted names, so users cannot work 
around it.
   
   The fix wraps every read field in backticks and doubles any embedded 
backtick. It reuses `DorisCatalogUtil.quoteIdentifier`, which the connector 
already applies to partition names. `SchemaChangeManager.quoteIdentifier` is 
not used because it does not escape embedded backticks.
   
   ```
   before: select Date,From from `test`.`test`
   after:  select `Date`,`From` from `test`.`test`
   ```
   
   The `select *` projection and the `doris.filter.query` text are left 
unchanged. The filter is user-written SQL, so users quote keyword column names 
there themselves.
   
   `DorisSourceSplitEnumeratorTest` now closes its static mock of 
`RestService`. The mock was never closed, so it leaked into later tests in the 
same JVM and made the new `RestService` test see `null` results.
   
   Closes #13369
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Doris source jobs whose read fields include Doris keywords now read the 
table instead of failing with `Doris FE's response cannot map to schema`. Jobs 
without such read fields send the same query apart from the added backticks, 
which Doris treats as the same identifiers.
   
   ### How was this patch tested?
   
   Added `RestServiceTest` for the query plan SQL. It covers keyword read 
fields taken from the issue report, a read field containing a backtick, and an 
empty schema with a filter query. The keyword and backtick cases fail on the 
previous unquoted SQL.
   
   Added `DorisIT.testReadKeywordColumns`. It reads a table with the keyword 
columns `from`, `desc`, `to` and `system` next to a plain `id` column. The 
Assert sink checks that exactly one row is read and that every field is not 
null and equals its seeded value. The E2E test needs Docker, so it compiles 
locally and runs in CI.
   
   ### 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/developer/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)
   
   ## AI Disclosure
   
   Human-led contribution. Grok Bot, working for dragonknightk, assisted with 
this change, including the code, tests, and description. All submitted content 
was reviewed by a human before submission.
   
   (๑•̀ㅂ•́)و✧
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to