Skip to content

Commit 6a17894

Browse files
committed
update error message
Signed-off-by: Kai Huang <[email protected]>
1 parent bc510e7 commit 6a17894

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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
@@ -361,8 +361,10 @@ public RelNode visit(TableScan scan) {
361361
&& errorMsg.contains("Error while preparing plan")
362362
&& errorMsg.contains("WIDTH_BUCKET")) {
363363
throw new UnsupportedOperationException(
364-
"The 'bins' parameter on timestamp fields is not supported when pushdown is"
365-
+ " disabled.");
364+
"The 'bins' parameter on timestamp fields requires: (1) pushdown to be enabled"
365+
+ " (controlled by plugins.calcite.pushdown.enabled, enabled by default), and"
366+
+ " (2) the timestamp field to be used as an aggregation bucket (e.g., 'stats"
367+
+ " count() by @timestamp').");
366368
}
367369
throw Util.throwAsRuntime(e);
368370
}

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
@@ -1146,11 +1146,12 @@ public void testBinsOnTimeFieldWithPushdownDisabled_ShouldFail() throws IOExcept
11461146
// @timestamp)
11471147
String errorMessage = exception.getMessage();
11481148
assertTrue(
1149-
"Expected clear error message about bins parameter not supported on timestamp fields when "
1150-
+ "pushdown is disabled, but got: "
1149+
"Expected clear error message about bins parameter requirements on timestamp fields, but"
1150+
+ " got: "
11511151
+ errorMessage,
1152-
errorMessage.contains(
1153-
"bins' parameter on timestamp fields is not supported when pushdown is disabled"));
1152+
errorMessage.contains("bins' parameter on timestamp fields requires")
1153+
&& errorMessage.contains("pushdown to be enabled")
1154+
&& errorMessage.contains("aggregation bucket"));
11541155
}
11551156

11561157
@Test

0 commit comments

Comments
 (0)