You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "shibd (via GitHub)" <gi...@apache.org> on 2024/07/17 01:45:54 UTC

[PR] [improve][io] The JDBC connector supports JSON substructure schema [pulsar]

shibd opened a new pull request, #23043:
URL: https://github.com/apache/pulsar/pull/23043

   ### Motivation
   Currently, when JDBC to convert value that has substructure schema, will get error:
   ```
   java.lang.Exception: Not supported value type, need to add it. class org.apache.pulsar.client.impl.schema.generic.GenericJsonRecord
   ```
   
   I know handling substructure types is complex, and JDBC databases may not always support defining substructure types.
   
   However, it is possible to write the substructure type as a JSON string into the table. This can be very useful for databases that support JSON parsing.
   
   For examples:
   1. JSON data
   ```
   {
       "state": "ts",
       "zipCode": 1000,
       "pcList": [
           {
               "brand": "b1",
               "model": "m1"
           },
           {
               "brand": "b2",
               "model": "m2"
           }
       ]
   }
   ```
   2. We can insert it to table like:
   
   |state|zipCode|pcList|
   |---|---|---|
   |ts|1000|[{"brand":"b1","model":"m1"},{"brand":"b2","model":"m2"}]|
   
   
   ### Modifications
   
   - When `value instanceof GenericJsonRecord`, use jsonNode string.
   
   ### Verifying this change
   - Add `testSubFieldJsonArray` to cover it.
   
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


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

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


Re: [PR] [improve][io] The JDBC connector supports JSON substructure schema [pulsar]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #23043:
URL: https://github.com/apache/pulsar/pull/23043#issuecomment-2232307451

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/23043?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: Patch coverage is `50.00000%` with `1 line` in your changes missing coverage. Please review.
   > Project coverage is 73.43%. Comparing base [(`bbc6224`)](https://app.codecov.io/gh/apache/pulsar/commit/bbc62245c5ddba1de4b1e7cee4ab49334bc36277?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`f860ca8`)](https://app.codecov.io/gh/apache/pulsar/commit/f860ca8057b4f4f22d602d846ac527e44b81116d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 453 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/23043/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/23043?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #23043      +/-   ##
   ============================================
   - Coverage     73.57%   73.43%   -0.15%     
   - Complexity    32624    33101     +477     
   ============================================
     Files          1877     1914      +37     
     Lines        139502   143627    +4125     
     Branches      15299    15672     +373     
   ============================================
   + Hits         102638   105469    +2831     
   - Misses        28908    30085    +1177     
   - Partials       7956     8073     +117     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23043/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.61% <0.00%> (+3.02%)` | :arrow_up: |
   | [systests](https://app.codecov.io/gh/apache/pulsar/pull/23043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.66% <0.00%> (+0.34%)` | :arrow_up: |
   | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23043/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.50% <50.00%> (-0.35%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files](https://app.codecov.io/gh/apache/pulsar/pull/23043?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [.../apache/pulsar/io/jdbc/BaseJdbcAutoSchemaSink.java](https://app.codecov.io/gh/apache/pulsar/pull/23043?src=pr&el=tree&filepath=pulsar-io%2Fjdbc%2Fcore%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fio%2Fjdbc%2FBaseJdbcAutoSchemaSink.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWlvL2pkYmMvY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2lvL2pkYmMvQmFzZUpkYmNBdXRvU2NoZW1hU2luay5qYXZh) | `74.48% <50.00%> (+1.62%)` | :arrow_up: |
   
   ... and [500 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23043/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   </details>


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

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


Re: [PR] [improve][io] The JDBC connector supports JSON substructure schema [pulsar]

Posted by "shibd (via GitHub)" <gi...@apache.org>.
shibd merged PR #23043:
URL: https://github.com/apache/pulsar/pull/23043


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

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