File tree Expand file tree Collapse file tree
plugin/trino-bigquery/src/test/java/io/trino/plugin/bigquery Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828import static io .trino .spi .type .VarcharType .VARCHAR ;
2929import static io .trino .testing .MaterializedResult .resultBuilder ;
3030import static io .trino .testing .assertions .Assert .assertEquals ;
31+ import static io .trino .testing .sql .TestTable .randomTableSuffix ;
3132import static java .lang .String .format ;
3233import static org .assertj .core .api .Assertions .assertThat ;
3334
@@ -133,6 +134,25 @@ public void testCountAggregationView()
133134 "VALUES (1)" );
134135 }
135136
137+ /**
138+ * regression test for https://github.com/trinodb/trino/issues/6696
139+ */
140+ @ Test
141+ public void testRepeatCountAggregationView ()
142+ {
143+ BigQuery client = createBigQueryClient ();
144+
145+ String viewName = "test.repeat_count_aggregation_view_" + randomTableSuffix ();
146+
147+ executeBigQuerySql (client , "DROP VIEW IF EXISTS " + viewName );
148+ executeBigQuerySql (client , "CREATE VIEW " + viewName + " AS SELECT 1 AS col1" );
149+
150+ assertQuery ("SELECT count(*) FROM " + viewName , "VALUES (1)" );
151+ assertQuery ("SELECT count(*) FROM " + viewName , "VALUES (1)" );
152+
153+ executeBigQuerySql (client , "DROP VIEW " + viewName );
154+ }
155+
136156 private static void executeBigQuerySql (BigQuery bigquery , String query )
137157 {
138158 QueryJobConfiguration queryConfig = QueryJobConfiguration .newBuilder (query )
You can’t perform that action at this time.
0 commit comments