Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ public void unsupportedFeatureIsRethrownAsSemanticCheckException() {
.assertErrorMessageContains("unsupported in Calcite");
}

@Test
public void unsupportedWindowFunctionIsRethrownAsSemanticCheckException() {
// Window functions outside WINDOW_FUNC_MAPPING reach
// CalciteRexNodeVisitor#visitWindowFunction's
// orElseThrow. The throw site emits CalciteUnsupportedException so this path normalizes to a
// 4xx SemanticCheckException rather than escaping as a 500.
givenInvalidQuery("source = catalog.employees | eventstats rank()")
.assertErrorType(SemanticCheckException.class)
.assertCauseType(CalciteUnsupportedException.class)
.assertErrorMessageContains("Unexpected window function: rank");
}

@Test
public void assertionErrorIsWrappedAsSemanticCheckException() {
// Remove when the underlying Calcite assertion is fixed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ public RexNode visitWindowFunction(WindowFunction node, CalcitePlanContext conte
node.getWindowFrame());
})
.orElseThrow(
() -> new UnsupportedOperationException("Unexpected window function: " + funcName));
() -> new CalciteUnsupportedException("Unexpected window function: " + funcName));
}

private List<RexNode> translateOrderKeys(
Expand Down
Loading