Skip to content

Commit 996b670

Browse files
committed
update error message
Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 783831a commit 996b670

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

core/src/main/java/org/opensearch/sql/calcite/utils/CalciteToolsHelper.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ public RelNode visit(TableScan scan) {
366366
&& errorMsg.contains("Error while preparing plan")
367367
&& errorMsg.contains("WIDTH_BUCKET")) {
368368
throw new UnsupportedOperationException(
369-
"The 'bins' parameter on timestamp fields is not supported when pushdown is"
370-
+ " disabled.");
369+
"The 'bins' parameter on timestamp fields requires: (1) pushdown to be enabled"
370+
+ " (controlled by plugins.calcite.pushdown.enabled, enabled by default), and"
371+
+ " (2) the timestamp field to be used as an aggregation bucket (e.g., 'stats"
372+
+ " count() by @timestamp').");
371373
}
372374
throw Util.throwAsRuntime(e);
373375
}

integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteBinCommandIT.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,11 +1008,12 @@ public void testBinsOnTimeFieldWithPushdownDisabled_ShouldFail() throws IOExcept
10081008
// @timestamp)
10091009
String errorMessage = exception.getMessage();
10101010
assertTrue(
1011-
"Expected clear error message about bins parameter not supported on timestamp fields when "
1012-
+ "pushdown is disabled, but got: "
1011+
"Expected clear error message about bins parameter requirements on timestamp fields, but"
1012+
+ " got: "
10131013
+ errorMessage,
1014-
errorMessage.contains(
1015-
"bins' parameter on timestamp fields is not supported when pushdown is disabled"));
1014+
errorMessage.contains("bins' parameter on timestamp fields requires")
1015+
&& errorMessage.contains("pushdown to be enabled")
1016+
&& errorMessage.contains("aggregation bucket"));
10161017
}
10171018

10181019
@Test

0 commit comments

Comments
 (0)