fhueske commented on code in PR #29003:
URL: https://github.com/apache/flink/pull/29003#discussion_r3893642412
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/utils/SortUtil.scala:
##########
@@ -74,6 +74,21 @@ object SortUtil {
rowType.getFieldList.get(idx)
}
+ /** Error message when the primary streaming sort key is not a time
attribute. */
+ def sortKeyNotTimeAttributeMessage(column: String, tpe: LogicalType): String
=
+ s"Streaming ORDER BY requires the primary sort key to be a time attribute
in ascending " +
+ s"order, but '$column' is ${tpe.asSummaryString}. A time attribute is an
event-time column " +
+ s"(a TIMESTAMP with a WATERMARK) or a processing-time column. Otherwise
use LIMIT for " +
+ s"Top-N, sort within a window, or run in batch mode."
+
+ /**
+ * Error message when the primary streaming sort key is a time attribute but
sorted descending.
+ */
+ def sortKeyTimeAttributeMustBeAscendingMessage(column: String): String =
+ s"Streaming ORDER BY on time attribute '$column' must be sorted in
ascending order; " +
Review Comment:
This error message should be fine, because we already inferred that `column`
is a time attribute (and it wouldn't if it was some expression other than a
fieldRef.
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/utils/SortUtil.scala:
##########
@@ -74,6 +74,21 @@ object SortUtil {
rowType.getFieldList.get(idx)
}
+ /** Error message when the primary streaming sort key is not a time
attribute. */
+ def sortKeyNotTimeAttributeMessage(column: String, tpe: LogicalType): String
=
Review Comment:
sorting can also happen on expressions, it doesn't have to be a column.
For example `... ORDER BY (someCol % 3) DESC` is a valid order by clause.
So the error message might be misleading (depending on how `column` is
resolved for non-columns).
--
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]