mcvsubbu commented on a change in pull request #4959: Add schemaFile as option 
in AddTableCommand
URL: https://github.com/apache/incubator-pinot/pull/4959#discussion_r363383402
 
 

 ##########
 File path: 
pinot-tools/src/main/java/org/apache/pinot/tools/admin/command/AddTableCommand.java
 ##########
 @@ -102,33 +111,55 @@ public AddTableCommand setExecute(boolean exec) {
     return this;
   }
 
-  public boolean execute(JsonNode node)
-      throws IOException {
-    if (_controllerHost == null) {
-      _controllerHost = NetUtil.getHostAddress();
+  public void uploadSchema()
+      throws Exception {
+    File schemaFile;
+    Schema schema;
+    try {
+      schemaFile = new File(_schemaFile);
+      schema = Schema.fromFile(schemaFile);
+    } catch (Exception e) {
+      LOGGER.error("Got exception while reading Pinot schema from file: [" + 
_schemaFile + "]");
+      throw e;
     }
-    _controllerAddress = "http://"; + _controllerHost + ":" + _controllerPort;
-
-    if (!_exec) {
-      LOGGER.warn("Dry Running Command: " + toString());
-      LOGGER.warn("Use the -exec option to actually execute the command.");
-      return true;
+    try (FileUploadDownloadClient fileUploadDownloadClient = new 
FileUploadDownloadClient()) {
+      fileUploadDownloadClient.addSchema(
+          FileUploadDownloadClient.getUploadSchemaHttpURI(_controllerHost, 
Integer.parseInt(_controllerPort)),
 
 Review comment:
   Do we still want to upload schema if `exec` is not true?

----------------------------------------------------------------
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