Skip to content

Commit

Permalink
Fix GROUP BY over EXTRACT test to not constant-fold
Browse files Browse the repository at this point in the history
This also fixes a query failure during the new year period caused by
the time zone in TestingSession (used by Presto) being different from
the JVM time zone (used by H2).
  • Loading branch information
electrum committed Jan 4, 2019
1 parent 54d46f3 commit 4e46ee1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -638,14 +638,14 @@ public void testGroupByNullIf()
public void testGroupByExtract()
{
// whole expression in group by
assertQuery("SELECT EXTRACT(YEAR FROM now()), count(*) FROM orders GROUP BY EXTRACT(YEAR FROM now())");
assertQuery("SELECT EXTRACT(YEAR FROM orderdate), count(*) FROM orders GROUP BY EXTRACT(YEAR FROM orderdate)");

assertQuery(
"SELECT EXTRACT(YEAR FROM now()), count(*) FROM orders GROUP BY 1",
"SELECT EXTRACT(YEAR FROM now()), count(*) FROM orders GROUP BY EXTRACT(YEAR FROM now())");
"SELECT EXTRACT(YEAR FROM orderdate), count(*) FROM orders GROUP BY 1",
"SELECT EXTRACT(YEAR FROM orderdate), count(*) FROM orders GROUP BY EXTRACT(YEAR FROM orderdate)");

// argument in group by
assertQuery("SELECT EXTRACT(YEAR FROM now()), count(*) FROM orders GROUP BY now()");
assertQuery("SELECT EXTRACT(YEAR FROM orderdate), count(*) FROM orders GROUP BY orderdate");
}

@Test
Expand Down

0 comments on commit 4e46ee1

Please sign in to comment.