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

jfim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 5900ff1  Fix NPE on configs with per-profile table types (#3503)
5900ff1 is described below

commit 5900ff10f487725ccc85abda79609e9c5c2cf2b1
Author: Jean-François Im <jeanfrancois...@gmail.com>
AuthorDate: Tue Dec 4 12:39:50 2018 -0800

    Fix NPE on configs with per-profile table types (#3503)
    
    Fix NPEs on configurations that have per-profile table types, leading to
    a merged output that has table-type specific keys for profiles that have
    only one table type when other profiles have two table types.
---
 .../pinot/common/config/AdjustTableNameChildKeyTransformer.java   | 4 +++-
 .../common/config/CombinedConfigSeparatorChildKeyTransformer.java | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/AdjustTableNameChildKeyTransformer.java
 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/AdjustTableNameChildKeyTransformer.java
index 7194caa..76a3fbd 100644
--- 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/AdjustTableNameChildKeyTransformer.java
+++ 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/AdjustTableNameChildKeyTransformer.java
@@ -43,7 +43,9 @@ public class AdjustTableNameChildKeyTransformer implements 
ChildKeyTransformer {
         .getOrElse(List.empty())
         .map(Object::toString);
 
-    String tableName = 
childKeys.get("table.name").map(Object::toString).getOrNull();
+    String tableName = 
childKeys.get("table.name").map(Object::toString).getOrElse(
+            () -> 
childKeys.get("table.name.realtime").map(Object::toString).getOrElse(
+                () -> 
childKeys.get("table.name.offline").map(Object::toString).getOrNull()));
 
     Map<String, Object> remappedConfig = (Map<String, Object>) childKeys;
 
diff --git 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
index db029e2..f8fef31 100644
--- 
a/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
+++ 
b/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigSeparatorChildKeyTransformer.java
@@ -45,6 +45,14 @@ public class CombinedConfigSeparatorChildKeyTransformer 
implements ChildKeyTrans
     // Move keys around so that they match with the combined config
     Map<String, Object> remappedConfig = config.flatMap((k, v) -> {
       if(k.startsWith("table.schema.")) {
+        // Remove realtime/offline suffixes
+        if (k.endsWith(".realtime")) {
+          k = k.substring(0, k.length() - ".realtime".length());
+        }
+        if (k.endsWith(".offline")) {
+          k = k.substring(0, k.length() - ".offline".length());
+        }
+
         // table.schema.foo -> schema.foo
         return List.of(Tuple.of(k.replaceFirst("table.schema", "schema"), v));
       } else if (k.endsWith(".realtime") && hasRealtime) {


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

Reply via email to