Sandeep Singh created SPARK-41899:
-------------------------------------

             Summary: DataFrame.createDataFrame converting int to bigint
                 Key: SPARK-41899
                 URL: https://issues.apache.org/jira/browse/SPARK-41899
             Project: Spark
          Issue Type: Sub-task
          Components: Connect
    Affects Versions: 3.4.0
            Reporter: Sandeep Singh


{code:java}
from pyspark.sql.functions import assert_true

df = self.spark.range(3)

self.assertEqual(
    df.select(assert_true(df.id < 3)).toDF("val").collect(),
    [Row(val=None), Row(val=None), Row(val=None)],
)

with self.assertRaises(Py4JJavaError) as cm:
    df.select(assert_true(df.id < 2, "too big")).toDF("val").collect(){code}
{code:java}
df = self.spark.createDataFrame([(1, "1"), (2, "2"), (1, "2"), (1, "2")], 
["key", "value"])
w = Window.partitionBy("value").orderBy("key")
from pyspark.sql import functions as F

sel = df.select(
    df.value,
    df.key,
    F.max("key").over(w.rowsBetween(0, 1)),
    F.min("key").over(w.rowsBetween(0, 1)),
    F.count("key").over(w.rowsBetween(float("-inf"), float("inf"))),
    F.row_number().over(w),
    F.rank().over(w),
    F.dense_rank().over(w),
    F.ntile(2).over(w),
)
rs = sorted(sel.collect()){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to