auroflow commented on code in PR #28934:
URL: https://github.com/apache/flink/pull/28934#discussion_r3756657363
##########
flink-python/pyflink/dataframe/convert.py:
##########
@@ -120,10 +148,239 @@ def _validate_schema(schema: List[str]) -> None:
raise ValueError("schema field names must be unique")
+def _resolve_column_names(
+ input_names: Sequence[str], schema: Optional[List[str]]
+) -> List[str]:
+ column_names = list(input_names) if schema is None else schema
+ if (
+ schema is not None
+ and isinstance(schema, list)
+ and len(schema) != len(input_names)
+ ):
+ raise ValueError(
+ f"schema has {len(schema)} fields but data has "
+ f"{len(input_names)} columns"
+ )
+ _validate_schema(column_names)
+ return column_names
+
+
+def _parse_watermark(
+ watermark: Optional[Tuple[str, str]],
+) -> Optional[_WatermarkSpec]:
+ if watermark is None:
+ return None
+ if not isinstance(watermark, tuple) or len(watermark) != 2:
+ raise TypeError("watermark must be a tuple of (column, expression)")
+ if any(not isinstance(value, str) or not value.strip() for value in
watermark):
+ raise TypeError("watermark column and expression must be non-empty
strings")
+ return _WatermarkSpec(*watermark)
+
+
+def _normalize_watermark_row_type(row_type: RowType, watermark:
_WatermarkSpec) -> RowType:
Review Comment:
Moved under `_WaterMarkSpec`.
--
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]