@@ -182,6 +182,13 @@ public Object parseValue(String value) {
182182 * SNI SSL parameter that will be set for each outbound SSL socket.
183183 */
184184 SSL_SOCKET_SNI ("ssl_socket_sni" , String .class ,"" ),
185+
186+ /**
187+ * Prefix for custom settings. Should be aligned with server configuration.
188+ * See <a href="https://clickhouse.com/docs/operations/settings/query-level#custom_settings">ClickHouse Docs</a>
189+ */
190+ CUSTOM_SETTINGS_PREFIX ("clickhouse_setting_" , String .class , "custom_" ),
191+
185192 ;
186193
187194 public static final String NO_THROW_ON_UNKNOWN_CONFIG = "no_throw_on_unknown_config" ;
@@ -224,8 +231,6 @@ public <T> T getDefObjVal() {
224231
225232 public static final String SERVER_SETTING_PREFIX = "clickhouse_setting_" ;
226233
227- public static final String CUSTOM_SETTING_PREFIX = "custom_" ;
228-
229234 // Key used to identify default value in configuration map
230235 public static final String DEFAULT_KEY = "_default_" ;
231236
@@ -338,10 +343,12 @@ public static Map<String, Object> parseConfigMap(Map<String, String> configMap)
338343 }
339344 }
340345
346+ final String customSettingsPrefix = configMap .getOrDefault (ClientConfigProperties .CUSTOM_SETTINGS_PREFIX .getKey (),
347+ CUSTOM_SETTINGS_PREFIX .getDefaultValue ());
341348 for (String key : new HashSet <>(tmpMap .keySet ())) {
342349 if (key .startsWith (HTTP_HEADER_PREFIX ) || key .startsWith (SERVER_SETTING_PREFIX )) {
343350 parsedConfig .put (key , tmpMap .remove (key ));
344- } else if (key .startsWith (CUSTOM_SETTING_PREFIX )) {
351+ } else if (key .startsWith (customSettingsPrefix )) {
345352 parsedConfig .put (serverSetting (key ), tmpMap .remove (key ));
346353 }
347354 }
0 commit comments