Skip to content

[SPARK-53001][TESTS] Fix test_df_unpivot to pass with Spark 4.0 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sarutak
Copy link
Member

@sarutak sarutak commented Jul 29, 2025

Description

This PR proposes to fix the issue that test_df_unpivot doesn't pass with Spark 4.0.

---- dataframe::tests::test_df_unpivot stdout ----
SparkSession Setup

thread 'dataframe::tests::test_df_unpivot' panicked at crates/connect/src/dataframe.rs:2463:9:
assertion `left == right` failed
  left: RecordBatch { schema: Schema { fields: [Field { name: "id", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "var", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "val", data_type: Float32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, columns: [PrimitiveArray<Int64>
[
  1,
  1,
  2,
  2,
], StringArray
[
  "int",
  "float",
  "int",
  "float",
], PrimitiveArray<Float32>
[
  11.0,
  1.1,
  12.0,
  1.2,
]], row_count: 4 }
 right: RecordBatch { schema: Schema { fields: [Field { name: "id", data_type: Int64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "var", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "val", data_type: Float64, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }, columns: [PrimitiveArray<Int64>
[
  1,
  1,
  2,
  2,
], StringArray
[
  "int",
  "float",
  "int",
  "float",
], PrimitiveArray<Float64>
[
  11.0,
  1.100000023841858,
  12.0,
  1.2000000476837158,
]], row_count: 4 }

As of Spark 4.0, ANSI mode is enabled by default but this test doesn't consider it.
To fix this issue, I tweaked the test so that the test pass in both ANSI mode is enabled or not.

Related Issue(s)

SPARK-53001

@xuanyuanking
Copy link
Member

LGTM, will merge after we have the merge script!

@sarutak
Copy link
Member Author

sarutak commented Aug 8, 2025

Now that we have a merge script am I OK to merge this by myself?

@xuanyuanking
Copy link
Member

Yep, just go ahead for straightforward fixes! Thanks Sarutak!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants