[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #3819: [CARBONDATA-3855]support carbon SDK to load data from different files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #3819: [CARBONDATA-3855]support carbon SDK to load data from different files

GitBox

VenuReddy2103 commented on a change in pull request #3819:
URL: https://github.com/apache/carbondata/pull/3819#discussion_r478395584



##########
File path: sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/JsonCarbonWriter.java
##########
@@ -91,4 +106,44 @@ public void close() throws IOException {
       throw new IOException(e);
     }
   }
+
+  private void loadSingleFile(CarbonFile file) throws IOException {
+    Reader reader = null;
+    try {
+      reader = SDKUtil.buildJsonReader(file, configuration);
+      JSONParser jsonParser = new JSONParser();
+      Object jsonRecord = jsonParser.parse(reader);
+      if (jsonRecord instanceof JSONArray) {
+        JSONArray jsonArray = (JSONArray) jsonRecord;
+        for (Object record : jsonArray) {
+          this.write(record.toString());
+        }
+      } else {
+        this.write(jsonRecord.toString());
+      }
+    } catch (Exception e) {

Review comment:
       Use specific exceptions instead of generic 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:
[hidden email]