This is an automated email from the ASF dual-hosted git repository. caogaofei pushed a commit to branch fix_last in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 347969a5e5555479f94eae70a21bce62d4915603 Author: Beyyes <[email protected]> AuthorDate: Thu Jan 16 18:50:37 2025 +0800 Add more user-friendly error messages for the last and last_by aggregations --- .../iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java | 8 ++++---- .../queryengine/plan/relational/metadata/TableMetadataImpl.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java index 21c53f12d07..f3af9db6147 100644 --- a/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/query/recent/IoTDBTableAggregationIT.java @@ -4065,19 +4065,19 @@ public class IoTDBTableAggregationIT { DATABASE_NAME); tableAssertTestFail( "select first() from table1", - "701: Aggregate functions [first] should only have two arguments", + "701: Aggregate functions [first] should only have one or two arguments", DATABASE_NAME); tableAssertTestFail( "select first_by() from table1", - "701: Aggregate functions [first_by] should only have three arguments", + "701: Aggregate functions [first_by] should only have two or three arguments", DATABASE_NAME); tableAssertTestFail( "select last() from table1", - "701: Aggregate functions [last] should only have two arguments", + "701: Aggregate functions [last] should only have one or two arguments", DATABASE_NAME); tableAssertTestFail( "select last_by() from table1", - "701: Aggregate functions [last_by] should only have three arguments", + "701: Aggregate functions [last_by] should only have two or three arguments", DATABASE_NAME); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java index fb437d3d596..cfac519f769 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java @@ -590,7 +590,7 @@ public class TableMetadataImpl implements Metadata { if (argumentTypes.size() != 2) { throw new SemanticException( String.format( - "Aggregate functions [%s] should only have two arguments", functionName)); + "Aggregate functions [%s] should only have one or two arguments", functionName)); } else if (!isTimestampType(argumentTypes.get(1))) { throw new SemanticException( String.format( @@ -602,7 +602,8 @@ public class TableMetadataImpl implements Metadata { if (argumentTypes.size() != 3) { throw new SemanticException( String.format( - "Aggregate functions [%s] should only have three arguments", functionName)); + "Aggregate functions [%s] should only have two or three arguments", + functionName)); } break; case SqlConstant.MAX_BY:
