You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/02/04 01:04:44 UTC

[GitHub] [pulsar] hanguyen6 opened a new issue #9466: Having record builder using JSON schema

hanguyen6 opened a new issue #9466:
URL: https://github.com/apache/pulsar/issues/9466


   
   I am trying to build a generic record from JSON schema dynamically using SchemaBuilder and RecordBuilder. 
   Below is the code snippet 
   
   `
       val recordBuilder = SchemaBuilder.record("testJson")
   
       recordBuilder.field("eventType").type(SchemaType.STRING)
       val si: SchemaInfo = recordBuilder.build(SchemaType.JSON)
       val pulsarSchema = org.apache.pulsar.client.api.Schema.generic(si)
   `
   `  
    
   
       val builder: GenericRecordBuilder = pulsarSchema.newRecordBuilder()
       builder.set("eventType", "test")
       val pulsarGenericRecord: GenericRecord = builder.build()`
   
   And got this exeception (Pulsar version 2.6.1) 
   
   `Json Schema doesn't support record builder yet
   java.lang.UnsupportedOperationException: Json Schema doesn't support record builder yet
   	at org.apache.pulsar.client.impl.schema.generic.GenericJsonSchema.newRecordBuilder(GenericJsonSchema.java:78)`
   
   Is there other way to build this generic record from JSON schema other than using POJO class ? 
   
   
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-788953685


   @hanguyen6 Have you tried using `schema.JSON(Map.class)`? I'm not sure if this can work for your case.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-966953087


   @codelipenghui  This feature has been completed by @vroyer . see #10052
    I think we can close this issues.


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



[GitHub] [pulsar] codelipenghui commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-772994779


   @hanguyen6 Currently, Pulsar only supports AVRO Generic Schema. I labeled as type/feature


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] codelipenghui commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-1058893509


   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



[GitHub] [pulsar] hanguyen6 commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
hanguyen6 commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-772995838


   @codelipenghui  thanks for confirmation. Is there other way I can build record dynamically using json schema ?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [pulsar] mattisonchao commented on issue #9466: Having record builder using JSON schema

Posted by GitBox <gi...@apache.org>.
mattisonchao commented on issue #9466:
URL: https://github.com/apache/pulsar/issues/9466#issuecomment-966370371


   I can work on it. :)


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