stevenzwu commented on code in PR #9728:
URL: https://github.com/apache/iceberg/pull/9728#discussion_r1526599885
##########
core/src/main/java/org/apache/iceberg/FileScanTaskParser.java:
##########
@@ -40,16 +40,32 @@ public class FileScanTaskParser {
private FileScanTaskParser() {}
+ /**
+ * Serialize file scan task to JSON string
+ *
+ * @deprecated Use {@link ScanTaskParser#toJson(FileScanTask)} instead; will
be removed in 1.7.0
+ */
+ @Deprecated
public static String toJson(FileScanTask fileScanTask) {
- return JsonUtil.generate(
- generator -> FileScanTaskParser.toJson(fileScanTask, generator),
false);
+ Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task:
null");
+ return JsonUtil.generate(generator -> toJson(fileScanTask, generator),
false);
+ }
+
+ /**
+ * Deserialize file scan task from JSON string
+ *
+ * @deprecated Use {@link ScanTaskParser#fromJson(String, boolean)} instead;
will be removed in
+ * 1.7.0
+ */
+ @Deprecated
+ public static FileScanTask fromJson(String json, boolean caseSensitive) {
+ Preconditions.checkArgument(json != null, "Invalid JSON string for file
scan task: null");
+ return JsonUtil.parse(json, node -> fromJson(node, caseSensitive));
}
- private static void toJson(FileScanTask fileScanTask, JsonGenerator
generator)
- throws IOException {
+ static void toJson(FileScanTask fileScanTask, JsonGenerator generator)
throws IOException {
Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task:
null");
Preconditions.checkArgument(generator != null, "Invalid JSON generator:
null");
- generator.writeStartObject();
Review Comment:
you are right. we should have add the start/end object in the deprecated
public method
```
@Deprecated
public static String toJson(FileScanTask fileScanTask) {
```
##########
core/src/main/java/org/apache/iceberg/FileScanTaskParser.java:
##########
@@ -40,16 +40,32 @@ public class FileScanTaskParser {
private FileScanTaskParser() {}
+ /**
+ * Serialize file scan task to JSON string
+ *
+ * @deprecated Use {@link ScanTaskParser#toJson(FileScanTask)} instead; will
be removed in 1.7.0
+ */
+ @Deprecated
public static String toJson(FileScanTask fileScanTask) {
- return JsonUtil.generate(
- generator -> FileScanTaskParser.toJson(fileScanTask, generator),
false);
+ Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task:
null");
+ return JsonUtil.generate(generator -> toJson(fileScanTask, generator),
false);
+ }
+
+ /**
+ * Deserialize file scan task from JSON string
+ *
+ * @deprecated Use {@link ScanTaskParser#fromJson(String, boolean)} instead;
will be removed in
+ * 1.7.0
+ */
+ @Deprecated
+ public static FileScanTask fromJson(String json, boolean caseSensitive) {
+ Preconditions.checkArgument(json != null, "Invalid JSON string for file
scan task: null");
+ return JsonUtil.parse(json, node -> fromJson(node, caseSensitive));
}
- private static void toJson(FileScanTask fileScanTask, JsonGenerator
generator)
- throws IOException {
+ static void toJson(FileScanTask fileScanTask, JsonGenerator generator)
throws IOException {
Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task:
null");
Preconditions.checkArgument(generator != null, "Invalid JSON generator:
null");
- generator.writeStartObject();
Review Comment:
you are right. should have added the start/end object in the deprecated
public method
```
@Deprecated
public static String toJson(FileScanTask fileScanTask) {
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]