You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "crossoverJie (via GitHub)" <gi...@apache.org> on 2023/08/07 08:15:15 UTC

[GitHub] [pulsar] crossoverJie opened a new issue, #20945: [Bug] When the Schema structure is incorrect, SQL queries return Not a record: "string"

crossoverJie opened a new issue, #20945:
URL: https://github.com/apache/pulsar/issues/20945

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Version
   
   master
   
   ### Minimal reproduce step
   
   
   
   ## Create producer
   `Producer p = pulsarClient.newProducer(Schema.JSON(String.class)).create()`
   
   It would generate the following schema:
   
   ```json
   {
     "version": 0,
     "schemaInfo": {
       "name": "schema-test-2",
       "schema": "\"string\"",
       "type": "JSON",
       "timestamp": 1691379461556,
       "properties": {
         "__alwaysAllowNull": "true",
         "__jsr310ConversionEnabled": "false"
       }
     }
   }
   ```
   
   And query from `Trino`:
   ```sql
   select * from pulsar."public/default"."schema-test-2";
   ```
   ![image](https://github.com/apache/pulsar/assets/15684156/94dcf40e-7741-4b89-9123-c052b5b13f16)
   
   `Trino` service did not report any exception.
   ![image](https://github.com/apache/pulsar/assets/15684156/16229a9e-6f86-42b0-a0fb-9fd0d04787f8)
   
   
   
   ### What did you expect to see?
   
   Query success.
   
   ### What did you see instead?
   
   Query 20230807_075157_00000_b7hfa failed: Not a record: "string"
   
   ### Anything else?
   
   This exception was thrown from there:
   
   https://github.com/apache/pulsar/blob/2ab184e49a036a1dd10dc537bef4ab034a5ad5e0/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericSchemaImpl.java#L43-L46
   
   
   Because there are a large amount of these types of codes in our production environment, we hope that they can be compatible in this situation in the `pulsar-sql` module.
   
   When parsing the Schema encounters exceptions, use defaultSchema to regenerate, like this:
   
   ![image](https://github.com/apache/pulsar/assets/15684156/565c4e73-ef43-46b3-afbe-d41989e194fb)
   
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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

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


[GitHub] [pulsar] github-actions[bot] commented on issue #20945: [Bug] When the Schema structure is incorrect, SQL queries return Not a record: "string"

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #20945:
URL: https://github.com/apache/pulsar/issues/20945#issuecomment-1710965311

   The issue had no activity for 30 days, mark with Stale label.


-- 
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