[
https://issues.apache.org/jira/browse/CALCITE-6414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Swett updated CALCITE-6414:
----------------------------------
Description:
The rewriteMacMInExpr is generating incorrect SQL for Snowflake.
Instead of BOOL_OR, it should be BOOLOR_AGG and instead BOOL_AND, it should be
BOOLAND_AGG
I think adding the following expectation in testMaxMinOnBooleanColumn should
repro:
{code:java}
@Test void testMaxMinOnBooleanColumn(){
...
final String expectedSnowflake = "SELECT BOOLOR_AGG(\"brand_name\" = 'a'), "
+ "BOOLAND_AGG(\"brand_name\" = 'a'), "
+ "MIN(\"brand_name\")\n"
+ "FROM \"foodmart\".\"product\"";
sql(query)
.ok(expected)
.withBigQuery().ok(expectedBigQuery)
.withPostgresql().ok(expectedPostgres)
.withSnowflak().ok(expectedSnowflake)
.withRedshift().ok(expectedPostgres);
}
{code}
was:
The rewriteMacMInExpr is generating incorrect SQL for Snowflake.
Instead of BOOL_OR, it should be BOOLOR_AGG and instead BOOL_AND, it should be
BOOLAND_AGG
I think adding the following expectation in testMaxMinOnBooleanColumn should
repro:
{code:java}
@Test void testMaxMinOnBooleanColumn(){
...
final String expectedSnowflake = "SELECT
BOOLOR_AGG(\"brand_name\" = 'a'), "
+ "BOOLAND_AGG(\"brand_name\" = 'a'), "
+ "MIN(\"brand_name\")\n"
+ "FROM \"foodmart\".\"product\"";
sql(query)
.ok(expected)
.withBigQuery().ok(expectedBigQuery)
.withPostgresql().ok(expectedPostgres)
.withSnowflak().ok(expectedSnowflake)
.withRedshift().ok(expectedPostgres);
}
{code}
> Resolve Snoflake SQL generation of BOOL_OR, BOOL_AND
> -----------------------------------------------------
>
> Key: CALCITE-6414
> URL: https://issues.apache.org/jira/browse/CALCITE-6414
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Justin Swett
> Priority: Trivial
>
> The rewriteMacMInExpr is generating incorrect SQL for Snowflake.
> Instead of BOOL_OR, it should be BOOLOR_AGG and instead BOOL_AND, it should
> be BOOLAND_AGG
>
> I think adding the following expectation in testMaxMinOnBooleanColumn should
> repro:
>
> {code:java}
> @Test void testMaxMinOnBooleanColumn(){
> ...
> final String expectedSnowflake = "SELECT BOOLOR_AGG(\"brand_name\" =
> 'a'), "
> + "BOOLAND_AGG(\"brand_name\" = 'a'), "
> + "MIN(\"brand_name\")\n"
> + "FROM \"foodmart\".\"product\"";
> sql(query)
> .ok(expected)
> .withBigQuery().ok(expectedBigQuery)
> .withPostgresql().ok(expectedPostgres)
> .withSnowflak().ok(expectedSnowflake)
> .withRedshift().ok(expectedPostgres);
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)