fib-seq commented on a change in pull request #1522: [CALCITE-3323] Handle
arbitrary/unknown functions that have ordinary syntax
URL: https://github.com/apache/calcite/pull/1522#discussion_r338429422
##########
File path:
core/src/main/java/org/apache/calcite/config/CalciteConnectionConfigImpl.java
##########
@@ -40,8 +40,13 @@ public CalciteConnectionConfigImpl(Properties properties) {
/** Returns a copy of this configuration with one property changed. */
public CalciteConnectionConfigImpl set(CalciteConnectionProperty property,
String value) {
- final Properties properties1 = new Properties(properties);
- properties1.setProperty(property.camelName(), value);
+ final Properties properties1 = new Properties();
+ this.properties.forEach((connectionProp, connectionValue) -> {
+ properties1.setProperty((String) connectionProp, (String)
connectionValue);
+ });
+ if (properties1.getProperty(property.camelName(), null) == null) {
+ properties1.setProperty(property.camelName(), value);
Review comment:
I agree, ideally it should override if a key is already present. Part of
this hack is due to how `connConfig()` obliterates the `CASE_SENSITIVE` and
`CONFORMANCE` defaults that may be passed in through `context`.
Ideally the flow should be in `connConfig()`:
- set defaults `CASE_SENSITIVE` and `CONFORMANCE`
- check context for `CalciteConnectionConfig`
- if `CalciteConnectionConfig` context exists, set/override defaults
properties within context
vs.
- getting `CalciteConnectionConfig` from context
- set defaults **but** don't override configs from context
I'm not sure the best approach to get the properties from a
CalciteConnectionConfig object. Any suggestions would be appreciated.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services