pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] sijie commented on a change in pull request #4022: Making use of builtin schemas for primitive types
Date Thu, 11 Apr 2019 04:25:20 GMT
sijie commented on a change in pull request #4022: Making use of builtin schemas for primitive
types
URL: https://github.com/apache/pulsar/pull/4022#discussion_r274246800
 
 

 ##########
 File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/TopicSchema.java
 ##########
 @@ -126,30 +139,66 @@ private static SchemaType getDefaultSchemaType(Class<?> clazz)
{
     @SuppressWarnings("unchecked")
     private static <T> Schema<T> newSchemaInstance(Class<T> clazz, SchemaType
type) {
         switch (type) {
-        case NONE:
-            return (Schema<T>) Schema.BYTES;
+            case NONE:
+                return (Schema<T>) Schema.BYTES;
 
-        case AUTO_CONSUME:
-        case AUTO:
-            return (Schema<T>) Schema.AUTO_CONSUME();
+            case AUTO_CONSUME:
+            case AUTO:
+                return (Schema<T>) Schema.AUTO_CONSUME();
 
-        case STRING:
-            return (Schema<T>) Schema.STRING;
+            case STRING:
+                return (Schema<T>) Schema.STRING;
 
-        case AVRO:
-            return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());
+            case AVRO:
+                return AvroSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());
 
-        case JSON:
-            return JSONSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());
+            case JSON:
+                return JSONSchema.of(SchemaDefinition.<T>builder().withPojo(clazz).build());
 
-        case KEY_VALUE:
-            return (Schema<T>)Schema.KV_BYTES();
+            case BOOLEAN:
+                return (Schema<T>) Schema.BOOL;
 
-        case PROTOBUF:
-            return ProtobufSchema.ofGenericClass(clazz, Collections.emptyMap());
+            case INT8:
+                return (Schema<T>) Schema.INT8;
 
-        default:
-            throw new RuntimeException("Unsupported schema type" + type);
+            case INT16:
+                return (Schema<T>) Schema.INT16;
+
+            case INT32:
+                return (Schema<T>) Schema.INT32;
+
+            case INT64:
+                return (Schema<T>) Schema.INT64;
+
+            case FLOAT:
+                return (Schema<T>) Schema.FLOAT;
+
+            case DOUBLE:
+                return (Schema<T>) Schema.DOUBLE;
+
+            case DATE:
+                return (Schema<T>) Schema.DATE;
+
+            case TIME:
+                return (Schema<T>) Schema.TIME;
+
+            case TIMESTAMP:
+                return (Schema<T>) Schema.TIMESTAMP;
+
+            case KEY_VALUE:
+                return (Schema<T>)Schema.KV_BYTES();
+
+            case PROTOBUF:
+                return ProtobufSchema.ofGenericClass(clazz, Collections.emptyMap());
+
+            case BYTES:
+                return (Schema<T>) Schema.BYTES;
+
+            case AUTO_PUBLISH:
 
 Review comment:
   How can this happen?

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


With regards,
Apache Git Services

Mime
View raw message