anew commented on code in PR #57412:
URL: https://github.com/apache/spark/pull/57412#discussion_r3633351299


##########
python/pyspark/pipelines/api.py:
##########
@@ -627,6 +641,13 @@ def create_auto_cdc_flow(
     except_column_list = _normalize_optional_column_list(
         arg_name="except_column_list", column_list=except_column_list
     )
+    track_history_column_list = _normalize_optional_column_list(

Review Comment:
   Went ahead and enforced this client-side for both pairs (b0f36da) rather 
than leaving it server-only — added a 
   _reject_include_and_except_together helper raising CANNOT_SET_TOGETHER, 
covering column_list/except_column_list and the track-history pair, so it now 
matches the docstrings' "only one" promise without a round-trip. Kept the 
server-side checks as defense for raw Connect clients and moved their coverage 
to raw-proto tests in SparkDeclarativePipelinesServerSuite.



##########
python/pyspark/pipelines/api.py:
##########
@@ -652,16 +673,31 @@ def create_auto_cdc_flow(
             },
         )
 
-    if stored_as_scd_type is not None and str(stored_as_scd_type) != "1":
+    if stored_as_scd_type is not None and str(stored_as_scd_type) not in ("1", 
"2"):
         raise PySparkTypeError(
             errorClass="NOT_EXPECTED_TYPE",
             messageParameters={
                 "arg_name": "stored_as_scd_type",
-                "expected_type": "Literal[1, '1']",
+                "expected_type": "Literal[1, 2, '1', '2']",
                 "arg_type": type(stored_as_scd_type).__name__,
             },
         )
 
+    # Track-history columns describe how consecutive upserts are coalesced 
into history records,
+    # a notion that only exists under SCD2. Reject them for any other SCD 
type. The engine
+    # enforces this too, but failing here gives a clearer, client-side error.
+    is_scd2 = stored_as_scd_type is not None and str(stored_as_scd_type) == "2"
+    if not is_scd2 and (
+        track_history_column_list is not None or 
track_history_except_column_list is not None
+    ):
+        raise PySparkValueError(
+            errorClass="INVALID_MULTIPLE_ARGUMENT_CONDITIONS",
+            messageParameters={
+                "arg_names": "track_history_column_list, 
track_history_except_column_list",
+                "condition": "specified unless stored_as_scd_type is 2 (or 
'2')",

Review Comment:
   Fixed



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to