mirror of https://github.com/apache/druid.git
Throw soft exception in case of empty signature while building Scan Query (#16502)
This commit is contained in:
parent
27cfe12f4a
commit
6bbf9613f8
|
@ -1602,7 +1602,8 @@ public class DruidQuery
|
|||
|
||||
if (outputRowSignature.size() == 0) {
|
||||
// Should never do a scan query without any columns that we're interested in. This is probably a planner bug.
|
||||
throw new ISE("Cannot convert to Scan query without any columns.");
|
||||
this.plannerContext.setPlanningError("Cannot convert to Scan query without any columns.");
|
||||
return null;
|
||||
}
|
||||
|
||||
final Pair<DataSource, Filtration> dataSourceFiltrationPair = getFiltration(
|
||||
|
|
|
@ -233,23 +233,49 @@ public class CalciteWindowQueryTest extends BaseCalciteQueryTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyWindowInSubquery()
|
||||
{
|
||||
testBuilder()
|
||||
.sql(
|
||||
"select c from (\n"
|
||||
+ " select channel, row_number() over () as c\n"
|
||||
+ " from wikipedia\n"
|
||||
+ " group by channel\n"
|
||||
+ ") LIMIT 5"
|
||||
)
|
||||
.queryContext(ImmutableMap.of(
|
||||
PlannerContext.CTX_ENABLE_WINDOW_FNS, true,
|
||||
QueryContexts.ENABLE_DEBUG, true,
|
||||
QueryContexts.WINDOWING_STRICT_VALIDATION, false
|
||||
))
|
||||
.expectedResults(ImmutableList.of(
|
||||
new Object[]{1L},
|
||||
new Object[]{2L},
|
||||
new Object[]{3L},
|
||||
new Object[]{4L},
|
||||
new Object[]{5L}
|
||||
))
|
||||
.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWindow()
|
||||
{
|
||||
testBuilder()
|
||||
.sql("SELECT\n" +
|
||||
"(rank() over (order by count(*) desc)),\n" +
|
||||
"(rank() over (order by count(*) desc))\n" +
|
||||
"FROM \"wikipedia\"")
|
||||
.queryContext(ImmutableMap.of(
|
||||
PlannerContext.CTX_ENABLE_WINDOW_FNS, true,
|
||||
QueryContexts.ENABLE_DEBUG, true,
|
||||
QueryContexts.WINDOWING_STRICT_VALIDATION, false
|
||||
))
|
||||
.expectedResults(ImmutableList.of(
|
||||
new Object[]{1L, 1L}
|
||||
))
|
||||
.run();
|
||||
.sql("SELECT\n" +
|
||||
"(rank() over (order by count(*) desc)),\n" +
|
||||
"(rank() over (order by count(*) desc))\n" +
|
||||
"FROM \"wikipedia\"")
|
||||
.queryContext(ImmutableMap.of(
|
||||
PlannerContext.CTX_ENABLE_WINDOW_FNS, true,
|
||||
QueryContexts.ENABLE_DEBUG, true,
|
||||
QueryContexts.WINDOWING_STRICT_VALIDATION, false
|
||||
))
|
||||
.expectedResults(ImmutableList.of(
|
||||
new Object[]{1L, 1L}
|
||||
))
|
||||
.run();
|
||||
}
|
||||
|
||||
private WindowOperatorQuery getWindowOperatorQuery(List<Query<?>> queries)
|
||||
|
|
Loading…
Reference in New Issue