Skip to content

[SQL] Optimize MAX(CASE WHEN ... THEN 1 ELSE 0 END) #5927

@mihaibudiu

Description

@mihaibudiu

This can be rewritten as

CASE WHEN COUNT(*) FILTER (WHERE ...) > 0 THEN 1 ELSE 0 END

This rewrite should probably be made in Calcite.

Metadata

Metadata

Assignees

Labels

SQL compilerRelated to the SQL compiler

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions