Hyukjin Kwon created SPARK-61012:
------------------------------------

             Summary: Sample by the fractions of sampleBy, and take a Column, 
in the Python client as PySpark does
                 Key: SPARK-61012
                 URL: https://issues.apache.org/jira/browse/SPARK-61012
             Project: Spark
          Issue Type: Bug
          Components: Connect
    Affects Versions: connect-rust-4.3.0
            Reporter: Hyukjin Kwon


In PySpark Connect, {{df.sampleBy(col, fractions, seed)}} sends each stratum of 
{{fractions}} with its fraction in the {{StatSampleBy}} relation, of a column 
name or a Column {{col}}; it raises {{NOT_EXPECTED_TYPE}} for a {{col}} that is 
neither or {{fractions}} that is not a dict, and 
{{DISALLOWED_TYPE_FOR_CONTAINER}} for a stratum that is not a float, an int or 
a string.

The Rust-backed Python client sends the strata without their fractions, so 
every fraction is 0 and the sample is empty: {{df.sampleBy("k", {"a": 1.0, "b": 
0.0}, seed=1).count()}} is 0, where PySpark 4.3.0 returns the 2 rows of 
{{"a"}}. It also takes only a column name. Sample by the fractions as PySpark 
does.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to