codelipenghui commented on a change in pull request #6325: KeyValue schema 
support for pulsar sql
URL: https://github.com/apache/pulsar/pull/6325#discussion_r379705015
 
 

 ##########
 File path: 
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarSplit.java
 ##########
 @@ -95,7 +97,23 @@ public PulsarSplit(
         this.tupleDomain = requireNonNull(tupleDomain, "tupleDomain is null");
         this.startPosition = PositionImpl.get(startPositionLedgerId, 
startPositionEntryId);
         this.endPosition = PositionImpl.get(endPositionLedgerId, 
endPositionEntryId);
+        this.schemaInfoProperties = schemaInfoProperties;
         this.offloadPolicies = offloadPolicies;
+
+        SchemaInfo schemaInfoTemp;
+        try {
+            ObjectMapper objectMapper = new ObjectMapper();
+            schemaInfoTemp = SchemaInfo.builder()
+                    .name(originSchemaName)
+                    .type(schemaType)
+                    .schema(schema.getBytes("ISO8859-1"))
+                    .properties(objectMapper.readValue(schemaInfoProperties, 
Map.class))
+                    .build();
+        } catch (Exception e) {
+            log.error("Create schemaInfo failed!", e);
+            schemaInfoTemp = SchemaInfo.builder().build();
 
 Review comment:
   If exception cause when reading schema properties, we'd better throw a 
runtime exception.
   

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


With regards,
Apache Git Services

Reply via email to