Skip to content

[CALCITE-3323] Handle arbitrary/unknown functions that have ordinary syntax#1522

Closed
fib-seq wants to merge 1 commit intoapache:masterfrom
fib-seq:calcite-3323-fixes
Closed

[CALCITE-3323] Handle arbitrary/unknown functions that have ordinary syntax#1522
fib-seq wants to merge 1 commit intoapache:masterfrom
fib-seq:calcite-3323-fixes

Conversation

@fib-seq
Copy link
Copy Markdown
Contributor

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

Added costFactory field and updated set to populate with original properties values

@fib-seq
Copy link
Copy Markdown
Contributor Author

fib-seq commented Oct 18, 2019

@julianhyde these are the fixes to the calcite code that for passing in context properly for connConfig() within PlannerImpl.

@julianhyde
Copy link
Copy Markdown
Contributor

Since CALCITE-3323 is fixed already, can you please create a new JIRA case. The description is "CalciteConnectionConfigImpl.set obliterates previous property values".

The cause is that new Properties(properties) doesn't copy the previous value as, say, new HashMap(map) does.

Can you add a unit test, say in PlannerTest, that if you call set(x, 1) then set(y, 2) on a CalciteConnectionConfigImpl, the result contains x and y.

properties1.setProperty((String) connectionProp, (String) connectionValue);
});
if (properties1.getProperty(property.camelName(), null) == 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.

If there is already the property key, we do not override ?

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.

+1

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.

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.

final Properties properties1 = new Properties();
this.properties.forEach((connectionProp, connectionValue) -> {
properties1.setProperty((String) connectionProp, (String) connectionValue);
});
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.

How about properties.clone() ?

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.

Yes, clone() looks promising.

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.

@jinxing64 I've moved this PR here and made the changes you suggested: #1528

@fib-seq fib-seq closed this Oct 24, 2019
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.

4 participants