Skip to content

Commit

Permalink
[TEST] connect: df.orderBy
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Dec 11, 2024
1 parent 11697bc commit eef12b3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/connect/test_order_by.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import annotations


def test_order_by(spark_session):
# Create a range using Spark and order it
spark_range = spark_session.range(10) # Creates DataFrame with numbers 0 to 9
ordered_df = spark_range.orderBy("id", ascending=False) # Order by id descending

# Collect results
collected_rows = ordered_df.collect()

# Verify the DataFrame has expected values and ordering
assert len(collected_rows) == 10
assert [row.id for row in collected_rows] == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]

0 comments on commit eef12b3

Please sign in to comment.