alpass163gmail commented on code in PR #18539:
URL: https://github.com/apache/iotdb/pull/18539#discussion_r3910537085
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/udf/builtin/relational/tvf/WindowTVFUtils.java:
##########
@@ -58,4 +89,152 @@ public static int findColumnIndex(
CommonMessages.EXCEPTION_REQUIRED_COLUMN_ARG_NOT_FOUND_SOURCE_TABLE_ARGUMENT_993E1C08,
expectedFieldName));
}
+
+ public static void validateOrderBy(TableArgument tableArgument, String
timeColumn) {
+ if (tableArgument.getOrderBy().size() != 1
+ || !tableArgument.getOrderBy().get(0).equalsIgnoreCase(timeColumn)) {
+ throw new SemanticException(
+ CommonMessages
+
.EXCEPTION_THE_ORDER_BY_CLAUSE_OF_THE_DATA_ARGUMENT_MUST_CONTAIN_EXACTLY_THE_TIME_COLUMN_SPECIFIED_BY_THE_TIMECOL_ARGUMENT_4375BAE9);
+ }
+ }
+
+ public static List<Integer> getPartitionIndexes(TableArgument tableArgument)
{
+ List<Integer> indexes = new ArrayList<>();
+ for (String partitionColumn : tableArgument.getPartitionBy()) {
+ indexes.add(findColumnIndex(tableArgument, partitionColumn,
SUPPORTED_PARTITION_TYPES));
+ }
+ return indexes;
+ }
+
+ /**
+ * Collect calculation-column indexes after excluding partition and time
columns.
+ *
+ * <p>If {@code calculationColumnConsumer} is provided, it is invoked with
each calculation column
+ * name so the caller can append the corresponding result field to its
output schema.
+ */
+ public static List<Integer> getCalculationIndexes(
+ TableArgument tableArgument,
+ Set<Integer> excludedIndexes,
+ Consumer<String> calculationColumnConsumer) {
+ List<Integer> calculationIndexes = new ArrayList<>();
+ for (int i = 0; i < tableArgument.getFieldTypes().size(); i++) {
+ if (excludedIndexes.contains(i)) {
+ continue;
+ }
+
+ Type type = tableArgument.getFieldTypes().get(i);
+ String columnName = tableArgument.getFieldNames().get(i).get();
Review Comment:
fixed it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]