fx19880617 commented on a change in pull request #4874: Pinot ingestion job - 
Standalone
URL: https://github.com/apache/incubator-pinot/pull/4874#discussion_r353544331
 
 

 ##########
 File path: 
pinot-batch-ingestion/pinot-standalone/src/main/java/org/apache/pinot/ingestion/standalone/SegmentGenerationJobRunner.java
 ##########
 @@ -227,41 +236,83 @@ public void run()
     }
   }
 
-  private Schema getSchema()
-      throws Exception {
-    URI schemaURI = new URI(_spec.getTableSpec().getSchemaURI());
+  private Schema getSchema() {
+    URI schemaURI;
+    try {
+      schemaURI = new URI(_spec.getTableSpec().getSchemaURI());
+    } catch (URISyntaxException e) {
+      throw new RuntimeException("Schema URI is not valid - " + 
_spec.getTableSpec().getSchemaURI(), e);
+    }
     String scheme = schemaURI.getScheme();
     String schemaJson;
     if (PinotFSFactory.isSchemeSupported(scheme)) {
       // Try to use PinotFS to read schema URI
       PinotFS pinotFS = PinotFSFactory.create(scheme);
-      InputStream schemaStream = pinotFS.open(schemaURI);
-      schemaJson = IOUtils.toString(schemaStream, StandardCharsets.UTF_8);
+      InputStream schemaStream;
+      try {
+        schemaStream = pinotFS.open(schemaURI);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to open schema file stream on Pinot 
fs - " + schemaURI, e);
+      }
+      try {
+        schemaJson = IOUtils.toString(schemaStream, StandardCharsets.UTF_8);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to read from schema file data 
stream on Pinot fs - " + schemaURI, e);
+      }
     } else {
       // Try to directly read from URI.
-      schemaJson = IOUtils.toString(schemaURI, StandardCharsets.UTF_8);
+      try {
+        schemaJson = IOUtils.toString(schemaURI, StandardCharsets.UTF_8);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to read from Schema URI - " + 
schemaURI, e);
+      }
+    }
+    try {
+      return Schema.fromString(schemaJson);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to decode Pinot schema from json 
string - " + schemaJson, e);
     }
-    return Schema.fromString(schemaJson);
   }
 
-  private TableConfig getTableConfig()
-      throws Exception {
-    URI tableConfigURI = new URI(_spec.getTableSpec().getTableConfigURI());
+  private TableConfig getTableConfig() {
+    URI tableConfigURI;
+    try {
+      tableConfigURI = new URI(_spec.getTableSpec().getTableConfigURI());
+    } catch (URISyntaxException e) {
+      throw new RuntimeException("Table config URI is not valid - " + 
_spec.getTableSpec().getTableConfigURI(), e);
+    }
     String scheme = tableConfigURI.getScheme();
     String tableConfigJson;
     if (PinotFSFactory.isSchemeSupported(scheme)) {
       // Try to use PinotFS to read table config URI
       PinotFS pinotFS = PinotFSFactory.create(scheme);
-      tableConfigJson = IOUtils.toString(pinotFS.open(tableConfigURI), 
StandardCharsets.UTF_8);
+      try {
+        tableConfigJson = IOUtils.toString(pinotFS.open(tableConfigURI), 
StandardCharsets.UTF_8);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to open table config file stream on 
Pinot fs - " + tableConfigURI, e);
+      }
     } else {
-      tableConfigJson = IOUtils.toString(tableConfigURI, 
StandardCharsets.UTF_8);
+      try {
+        tableConfigJson = IOUtils.toString(tableConfigURI, 
StandardCharsets.UTF_8);
+      } catch (IOException e) {
+        throw new RuntimeException("Failed to read from table config file data 
stream on Pinot fs - " + tableConfigURI,
+            e);
+      }
     }
     // Controller API returns a wrapper of table config.
-    JsonNode tableJsonNode = new ObjectMapper().readTree(tableConfigJson);
+    JsonNode tableJsonNode;
+    try {
+      tableJsonNode = new ObjectMapper().readTree(tableConfigJson);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to decode table config into JSON from 
String - " + tableConfigJson, e);
 
 Review comment:
   same reason as above, it would provide enough information to debug.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to