dlg99 opened a new issue #10271:
URL: https://github.com/apache/pulsar/issues/10271


   **Describe the bug**
   
   Schema type BYTES set for the topic is returned as Schema type NONE.
   
   I hit this issue while working on the sink that uses GenericObject / relies 
on AutoConsumeSchema returning correct schema.
   While there is a workaround there to make AutoConsumeSchema handle schema 
type NONE as BYTES this whole behavior is rather unexpected and illogical.
   
   **To Reproduce**
   
   ```
   $ bin/pulsar-admin schemas delete my-topic 
   $ bin/pulsar-admin schemas get my-topic
   HTTP 404 Not Found
   Reason: HTTP 404 Not Found
   ```
   This is ok.
   
   ```
   $ cat ~/schema2.json 
   {
       "type": "BYTES",
       "schema": "",
       "properties": {}
   }
   
   $ bin/pulsar-admin schemas upload --filename ~/schema2.json my-topic 
   $ bin/pulsar-admin schemas get my-topic    
   {
     "version": 8,
     "schemaInfo": {
       "name": "my-topic",
       "schema": "",
       "type": "NONE",
       "properties": {}
     }
   }
   ```
   
   **Expected behavior**
   
   Expect to get the same schema as the one I set (BYTES)
   
   **Desktop (please complete the following information):**
    - OS: macOS
   
   **Additional context**
   
   version 2.8.0-snapshot
   
   I think it is related to  SchemaRegistryServiceImpl 
convertToDomainType/convertFromDomainType where any type with type.getValue() < 
0  is treated as NONE.
   src/main/proto/SchemaRegistryFormat.proto doesn’t even have SchemaType.BYTES
   SchemaType.BYTES is -1.
   Other things with negative values there are AUTO/AUTO_CONSUME/AUTO_PUBLISH.
   
   I haven't looked at what else handles BYTES as a special case compared with 
other schemas (STRING, INT.., ...)
   


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

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


Reply via email to