Skip to content

[CALCITE-3436] CalciteConnectionConfigImpl.set obliterates previous property values#1528

Closed
fib-seq wants to merge 3 commits intoapache:masterfrom
fib-seq:calcite-3436
Closed

[CALCITE-3436] CalciteConnectionConfigImpl.set obliterates previous property values#1528
fib-seq wants to merge 3 commits intoapache:masterfrom
fib-seq:calcite-3436

Conversation

@fib-seq
Copy link
Copy Markdown
Contributor

@fib-seq fib-seq commented Oct 24, 2019

Resolved issue where if context was passed a CalciteConnectionConfig, it would not set the default CalciteConnectionConfig settings.

I introduced a few tests that checks for if the values will get obliterated upon calling CalciteConnectionConfigImpl.set(). Upon further inspection, when creating a new Properties object with properties argument, these will be stored in a defaults field. To return a copy of the config without having it set in the defaults field I cloned the properties field instead.

Lastly, refactored the frameworkConfig.getCostFactory() method into the field costFactory

final Properties properties1 = (Properties) this.properties.clone();
if (properties1.getProperty(property.camelName()) == null) {
properties1.setProperty(property.camelName(), value);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we set the property when the original value is null ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really a hack that I want to fix.

The issue is how connConfig() operates in PlannerImpl.java, right now we get a CalciteConnectionConfig from context and then set the defaults. If the defaults already exist we don't want to override the configs we get from context

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can you explain why we can not override ? It seems that the defaults and the re-set values are the same right ?

julianhyde pushed a commit to julianhyde/calcite that referenced this pull request Oct 24, 2019
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528
@asfgit asfgit closed this in 2c6ccd5 Oct 24, 2019
XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Nov 17, 2019
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528
XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Nov 20, 2019
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528
XuQianJin-Stars pushed a commit to XuQianJin-Stars/calcite that referenced this pull request Nov 20, 2019
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528
wangxlong pushed a commit to wangxlong/calcite that referenced this pull request Feb 13, 2020
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528
jamesstarr pushed a commit to jamesstarr/calcite that referenced this pull request Aug 28, 2025
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528

Change-Id: I53b7626845a753ed1d9539f8597166124b382b44
jamesstarr pushed a commit to jamesstarr/calcite that referenced this pull request Mar 16, 2026
…thods (Ryan Fu)

The 'isSet' method allows Planner to set "conformance" and "caseSensitive"
connection properties based on the parser configuration only if they
have not been explicitly set in the connection properties.

In PlannerImpl, store 'costFactory' and no longer store
'frameworkConfig'; it might prevent memory leaks.

Close apache#1528

Change-Id: I53b7626845a753ed1d9539f8597166124b382b44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants