[
https://issues.apache.org/jira/browse/CALCITE-3436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-3436:
---------------------------------
Description:
Currently the "set" method in {{CalciteConnectionConfigImpl}} has no effect if
the property is already set, and most people would find that behavior
surprising.
This change adds "isSet" and "unset" methods, and restores "set" to the obvious
behavior. If you want to set conditionally, you can check "isSet" first.
Using {{isSet}}, {{Planner.connConfig()}} is now able to merge parser config
and connection config in the way that you would expect. A property value in
parser config will override connection config only if the corresponding
property in connection config is not set.
The code in {{CalciteConnectionConfigImpl.set}} previously called {{new
Properties(properties)}} (whose behavior is a little confusing, because it sets
defaults) and now calls {{Properties.clone()}} (which is more straightforward).
was:
The cause is that `new Properties(properties)` doesn't copy the previous value
as, say, `new HashMap(map)` does.
* Add a unit test in PlannerTest, that if you call set(x, 1) then set(y, 2) on
a CalciteConnectionConfigImpl, the result contains x and y.
* Consider potentially using `clone()` as Properties implements Cloneable
> In CalciteConnectionConfigImpl, add "isSet" and "unset" methods
> ---------------------------------------------------------------
>
> Key: CALCITE-3436
> URL: https://issues.apache.org/jira/browse/CALCITE-3436
> Project: Calcite
> Issue Type: Bug
> Reporter: Ryan Fu
> Priority: Minor
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Currently the "set" method in {{CalciteConnectionConfigImpl}} has no effect
> if the property is already set, and most people would find that behavior
> surprising.
> This change adds "isSet" and "unset" methods, and restores "set" to the
> obvious behavior. If you want to set conditionally, you can check "isSet"
> first.
> Using {{isSet}}, {{Planner.connConfig()}} is now able to merge parser config
> and connection config in the way that you would expect. A property value in
> parser config will override connection config only if the corresponding
> property in connection config is not set.
> The code in {{CalciteConnectionConfigImpl.set}} previously called {{new
> Properties(properties)}} (whose behavior is a little confusing, because it
> sets defaults) and now calls {{Properties.clone()}} (which is more
> straightforward).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)