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

jfim pushed a commit to branch fix-npe-on-tables-with-per-profile-table-types
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 15397a22b1402391f23c483ee1df665470ecbcd2
Author: Jean-Francois Im <[email protected]>
AuthorDate: Thu Nov 15 12:11:23 2018 -0800

    Fix NPE on configs with per-profile table types
    
    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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to