You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jf...@apache.org on 2018/11/16 19:23:05 UTC

[incubator-pinot] branch apply-table-config-format-change created (now 8124826)

This is an automated email from the ASF dual-hosted git repository.

jfim pushed a change to branch apply-table-config-format-change
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 8124826  Change format of the ApplyConfig computed config

This branch includes the following new commits:

     new 8124826  Change format of the ApplyConfig computed config

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Change format of the ApplyConfig computed config

Posted by jf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jfim pushed a commit to branch apply-table-config-format-change
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 8124826fff2c5a35e656d1e3fd00db1dcf795695
Author: Jean-Francois Im <je...@gmail.com>
AuthorDate: Thu Nov 15 11:58:54 2018 -0800

    Change format of the ApplyConfig computed config
    
    Change the format of the computed config in ApplyConfig to make it
    easier to be reused by external tools. The new format is Java
    properties-style HOCON as opposed to the nested structure HOCON format.
---
 .../java/com/linkedin/pinot/common/config/Serializer.java     | 11 +++++++++++
 .../pinot/tools/admin/command/ApplyTableConfigCommand.java    |  3 +--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pinot-common/src/main/java/com/linkedin/pinot/common/config/Serializer.java b/pinot-common/src/main/java/com/linkedin/pinot/common/config/Serializer.java
index 44e030d..2f66a23 100644
--- a/pinot-common/src/main/java/com/linkedin/pinot/common/config/Serializer.java
+++ b/pinot-common/src/main/java/com/linkedin/pinot/common/config/Serializer.java
@@ -18,6 +18,7 @@ package com.linkedin.pinot.common.config;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import com.typesafe.config.ConfigRenderOptions;
+import com.typesafe.config.ConfigValueFactory;
 import io.vavr.Tuple;
 import io.vavr.collection.HashMap;
 import io.vavr.collection.List;
@@ -52,6 +53,16 @@ public class Serializer {
     return config.root().render(ConfigRenderOptions.defaults().setJson(false).setOriginComments(false));
   }
 
+  public static <T> String serializeToPropertiesString(T object) {
+    ConfigRenderOptions configRenderOptions =
+        ConfigRenderOptions.defaults().setJson(false).setOriginComments(false).setFormatted(false);
+    return serialize(object)
+        .map(keyValueTuple -> keyValueTuple._1 + "=" +
+            ConfigValueFactory.fromAnyRef(keyValueTuple._2).render(configRenderOptions))
+        .sorted()
+        .mkString("\n");
+  }
+
   private static <T> Map<String, ?> serialize(T object, Class<? extends T> clazz, String pathContext) throws Exception {
     if (object == null) {
       return HashMap.empty();
diff --git a/pinot-tools/src/main/java/com/linkedin/pinot/tools/admin/command/ApplyTableConfigCommand.java b/pinot-tools/src/main/java/com/linkedin/pinot/tools/admin/command/ApplyTableConfigCommand.java
index b08ada4..72616b7 100644
--- a/pinot-tools/src/main/java/com/linkedin/pinot/tools/admin/command/ApplyTableConfigCommand.java
+++ b/pinot-tools/src/main/java/com/linkedin/pinot/tools/admin/command/ApplyTableConfigCommand.java
@@ -24,7 +24,6 @@ import com.linkedin.pinot.controller.helix.ControllerRequestURLBuilder;
 import com.linkedin.pinot.tools.Command;
 import java.io.File;
 import java.io.InputStream;
-import java.util.List;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
@@ -80,7 +79,7 @@ public class ApplyTableConfigCommand extends AbstractBaseAdminCommand implements
       throw new RuntimeException("Table config does not contain a valid offline or realtime table definition.");
     }
 
-    String computedConfig = Serializer.serializeToString(combinedConfig);
+    String computedConfig = Serializer.serializeToPropertiesString(combinedConfig);
 
     if (_showComputedConfig) {
       System.out.println(computedConfig);


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