Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dataroaring committed Jul 4, 2024
1 parent 226229f commit a0bea7c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.annotations.SerializedName;
Expand Down Expand Up @@ -529,6 +530,9 @@ public JsonElement serialize(PartitionKey partitionKey, java.lang.reflect.Type r
jsonArray.add(typeAndKey);
}

// for compatibility in the future
jsonArray.add(new JsonPrimitive("unused"));

return jsonArray;
}

Expand All @@ -541,7 +545,7 @@ public PartitionKey deserialize(JsonElement json, java.lang.reflect.Type typeOfT
PartitionKey partitionKey = new PartitionKey();

JsonArray jsonArray = json.getAsJsonArray();
for (int i = 0; i < jsonArray.size(); i++) {
for (int i = 0; i < jsonArray.size() - 1; i++) {
PrimitiveType type = null;
type = context.deserialize(jsonArray.get(i).getAsJsonArray().get(0), PrimitiveType.class);
LiteralExpr key = context.deserialize(jsonArray.get(i).getAsJsonArray().get(1), Expr.class);
Expand Down Expand Up @@ -572,6 +576,8 @@ public PartitionKey deserialize(JsonElement json, java.lang.reflect.Type typeOfT
partitionKey.types.add(type);
partitionKey.keys.add(key);
}

// ignore the last element
return partitionKey;
}
}
Expand Down

0 comments on commit a0bea7c

Please sign in to comment.