Skip to content

Add pushdown for statistical aggregate functions to MySQL connector#6673

Merged
findepi merged 1 commit intotrinodb:masterfrom
MiguelWeezardo:mysql_statistical_function_pushdown
Jan 27, 2021
Merged

Add pushdown for statistical aggregate functions to MySQL connector#6673
findepi merged 1 commit intotrinodb:masterfrom
MiguelWeezardo:mysql_statistical_function_pushdown

Conversation

@MiguelWeezardo
Copy link
Copy Markdown
Member

No description provided.

@cla-bot cla-bot bot added the cla-signed label Jan 21, 2021
@mosabua mosabua added the needs-docs This pull request requires changes to the documentation label Jan 21, 2021
Comment on lines 61 to 62
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

JdbcColumnHandle columnHandle = (JdbcColumnHandle) context.getAssignment(input.getName());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that's already checked for in the pattern

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you pleasee rebase on top of #6667 ?
this line would need to be changed to

Suggested change
format("stddev_samp(%s)", columnHandle.toSqlExpression(context.getIdentifierQuote())),
format("stddev_samp(%s)", context.getIdentifierQuote().apply(columnHandle.getColumnName())),

@MiguelWeezardo MiguelWeezardo force-pushed the mysql_statistical_function_pushdown branch from 322edb3 to 905170d Compare January 25, 2021 11:15
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

stddev is an alias, so

  • rename this class to ImplementStddevSamp
  • add // TODO (https://github.com/trinodb/trino/issues/6189): remove stddev, an alias, from the list & simplify the pattern

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similar here

@MiguelWeezardo MiguelWeezardo force-pushed the mysql_statistical_function_pushdown branch from 905170d to be71572 Compare January 25, 2021 14:17
@MiguelWeezardo MiguelWeezardo force-pushed the mysql_statistical_function_pushdown branch from be71572 to 72a40aa Compare January 25, 2021 21:24
@MiguelWeezardo
Copy link
Copy Markdown
Member Author

@findepi Please merge if you think this version is OK.

public Pattern<AggregateFunction> getPattern()
{
return basicAggregation()
.with(functionName().matching(name -> STDDEV_FUNCTION_NAMES.stream().anyMatch(name::equalsIgnoreCase)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this can be ever better

Suggested change
.with(functionName().matching(name -> STDDEV_FUNCTION_NAMES.stream().anyMatch(name::equalsIgnoreCase)))
.with(functionName().matching(name -> "stddev". equalsIgnoreCase(name) || "stddev_samp". equalsIgnoreCase(name))

@findepi findepi merged commit 9876d32 into trinodb:master Jan 27, 2021
@findepi
Copy link
Copy Markdown
Member

findepi commented Jan 27, 2021

@MiguelWeezardo can you please follow up with docs update?

@findepi findepi added this to the 352 milestone Jan 27, 2021
@findepi findepi mentioned this pull request Jan 27, 2021
10 tasks
@MiguelWeezardo MiguelWeezardo deleted the mysql_statistical_function_pushdown branch January 27, 2021 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed needs-docs This pull request requires changes to the documentation

Development

Successfully merging this pull request may close these issues.

3 participants