snuyanzin commented on code in PR #29070:
URL: https://github.com/apache/flink/pull/29070#discussion_r3949933044
##########
flink-python/pyflink/dataframe/dataframe.py:
##########
@@ -1139,6 +1237,50 @@ def _quote_identifier(name: str) -> str:
return "`" + name.replace("`", "``") + "`"
+def _resolve_window_time_column(on: Union[str, Expression]) -> Expression:
+ if isinstance(on, str):
+ return table_col(on)
+ if isinstance(on, Expression):
+ return on
+ raise TypeError("on must be a column name or expression")
+
+
+def _window_dataframe(
+ table: Table, window_kind: str, time_col: Expression, *interval_exprs: Any
+) -> "DataFrame":
+ jvm = get_gateway().jvm
+ kind = getattr(
+
jvm.org.apache.flink.table.operations.WindowTableFunctionQueryOperation.WindowKind,
+ window_kind,
+ )
+ intervals = jvm.java.util.ArrayList()
+ for interval in interval_exprs:
+ intervals.add(interval)
+ operation_tree_builder = table._t_env._j_tenv.getOperationTreeBuilder()
+ window_op = operation_tree_builder.windowTableFunction(
+ kind,
+ time_col._j_expr,
+ intervals,
+ table._j_table.getQueryOperation(),
+ )
+ j_table = table._t_env._j_tenv.createTable(window_op)
+ return DataFrame(Table(j_table, table._t_env))
+
+
+def _to_interval_expression(value: Union["datetime.timedelta", Expression]) ->
Any:
+ if isinstance(value, datetime.timedelta):
+ millis = value // datetime.timedelta(milliseconds=1)
Review Comment:
i mean it looks like there are cases where we truncate here and cases where
we don't
for instance when there is expression
not sure if it is related to this PR only or not
--
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]