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

 ##########
 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:
   Dry run shouldn't upload schema. This check is at line 146.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to