Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
kgyrtkirk committed Jul 24, 2024
1 parent fd69824 commit d5dc13b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.apache.druid.catalog.model.facade.DatasourceFacade;
import org.apache.druid.catalog.model.table.ClusterKeySpec;
import org.apache.druid.common.utils.IdUtils;
import org.apache.druid.error.DruidException;
import org.apache.druid.error.InvalidSqlInput;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.granularity.Granularity;
Expand Down Expand Up @@ -919,4 +920,14 @@ private static boolean containsCall(SqlNode node,
}
}

@Override
protected void validateWindowClause(SqlSelect select)
{
SqlNodeList windows = select.getWindowList();
for (SqlNode sqlNode : windows) {
if(SqlUtil.containsAgg(sqlNode)) {
throw DruidException.defensive("ds");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,21 @@ public void windowQueryTestWithCustomContextMaxSubqueryBytes(String filename) th
}
}



@Test
public void testWithArrayConcat()
{
testBuilder()
.sql("select countryName, cityName, channel, "
+ "array_concat_agg(ARRAY['abc', channel], 10000) over (partition by cityName order by countryName) as c\n"
+ "from wikipedia\n"
+ "where countryName in ('Austria', 'Republic of Korea') "
+ "and (cityName in ('Vienna', 'Seoul') or cityName is null)\n"
+ "group by countryName, cityName, channel")
.sql("select \n"
+ " countryName, \n"
+ " cityName, \n"
+ " channel, \n"
+ " row_number() over w as c\n"
+ "from wikipedia \n"
+ "where countryName in ('Austria', 'Republic of Korea')\n"
+ "group by countryName, cityName, channel\n"
+ "window w as (partition by max(length(cityName)) order by countryName, cityName, channel, max(length(cityName)))")
.queryContext(ImmutableMap.of(
PlannerContext.CTX_ENABLE_WINDOW_FNS, true,
QueryContexts.ENABLE_DEBUG, true
Expand Down

0 comments on commit d5dc13b

Please sign in to comment.