lowka commented on code in PR #3627:
URL: https://github.com/apache/ignite-3/pull/3627#discussion_r1571796956


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/DefaultValue.java:
##########
@@ -68,9 +92,28 @@ public Type type() {
         return type;
     }
 
+    /** Serializes this default value or {@code null}. */
+    public abstract void writeTo(IgniteDataOutput os) throws IOException;
+
+    /** Reads default value or {@code null}. */
+    public static @Nullable DefaultValue readFrom(IgniteDataInput in) throws 
IOException {
+        int typeId = in.readByte();
+        if (typeId == Type.NO_DEFAULT) {
+            return null;
+        } else if (typeId == Type.CONSTANT.typeId) {
+            Object val = readValue(in);
+            return new ConstantValue(val);
+        } else if (typeId == Type.FUNCTION_CALL.typeId) {
+            String functionName = in.readUTF();
+            return new FunctionCall(functionName);
+        } else {
+            throw new IllegalArgumentException("Unexpected type: " + typeId);

Review Comment:
   You can not use references in case clause.



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/DefaultValue.java:
##########
@@ -68,9 +92,28 @@ public Type type() {
         return type;
     }
 
+    /** Serializes this default value or {@code null}. */
+    public abstract void writeTo(IgniteDataOutput os) throws IOException;
+
+    /** Reads default value or {@code null}. */
+    public static @Nullable DefaultValue readFrom(IgniteDataInput in) throws 
IOException {
+        int typeId = in.readByte();
+        if (typeId == Type.NO_DEFAULT) {
+            return null;
+        } else if (typeId == Type.CONSTANT.typeId) {
+            Object val = readValue(in);
+            return new ConstantValue(val);
+        } else if (typeId == Type.FUNCTION_CALL.typeId) {
+            String functionName = in.readUTF();
+            return new FunctionCall(functionName);
+        } else {
+            throw new IllegalArgumentException("Unexpected type: " + typeId);

Review Comment:
   You cannot use references in case clause.



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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to