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:25:29 UTC
[incubator-pinot] 01/01: Change profile separator to triple
underscores
This is an automated email from the ASF dual-hosted git repository.
jfim pushed a commit to branch change-profile-separator
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
commit cfd5cc4c1f6cb0e2a4bec50fe53dcbcb5775453c
Author: Jean-Francois Im <je...@gmail.com>
AuthorDate: Thu Nov 15 12:15:35 2018 -0800
Change profile separator to triple underscores
Change the profile separator in the configuration to be triple
underscores, to avoid issues with tables that have underscores in their
table schemas.
---
.../com/linkedin/pinot/common/config/CombinedConfigLoader.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigLoader.java b/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigLoader.java
index 4c87b8d..45cbcf3 100644
--- a/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigLoader.java
+++ b/pinot-common/src/main/java/com/linkedin/pinot/common/config/CombinedConfigLoader.java
@@ -37,6 +37,8 @@ import java.util.Map;
* {@link java.lang.String}, {@link java.util.Map}, etc.
*/
public class CombinedConfigLoader {
+ private static final String PROFILE_SEPARATOR = "___";
+
static io.vavr.collection.Map<String, ?> loadConfigFromFile(File file, String... profiles) {
ConfigParseOptions options = ConfigParseOptions.defaults().prependIncluder(new ConfigIncluder() {
private ConfigIncluder parent = null;
@@ -75,14 +77,14 @@ public class CombinedConfigLoader {
// Get all profile-specific keys
Set<String> profileKeys = configMap.keySet()
- .filter(key -> key.contains("_"))
+ .filter(key -> key.contains(PROFILE_SEPARATOR))
.toSet();
// Keep profile-specific keys for enabled profiles
Set<String> enabledProfileKeys = profileKeys
.filter(key -> {
- int lastUnderscoreIndex = key.lastIndexOf('_');
- String profile = key.substring(lastUnderscoreIndex + 1, key.length());
+ int lastUnderscoreIndex = key.lastIndexOf(PROFILE_SEPARATOR);
+ String profile = key.substring(lastUnderscoreIndex + PROFILE_SEPARATOR.length(), key.length());
return enabledProfiles.contains(profile);
});
@@ -90,7 +92,7 @@ public class CombinedConfigLoader {
io.vavr.collection.Map<String, ConfigValue> overrideConfigMap = HashMap.empty();
for (String enabledProfileKey : enabledProfileKeys) {
- int lastUnderscoreIndex = enabledProfileKey.lastIndexOf('_');
+ int lastUnderscoreIndex = enabledProfileKey.lastIndexOf(PROFILE_SEPARATOR);
String destinationKey = enabledProfileKey.substring(0, lastUnderscoreIndex);
if (!overrideConfigMap.containsKey(destinationKey)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org