Skip to content

[SPARK-51773][SQL] Turn file formats into case classes to properly compare them #50562

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

Conversation

vladimirg-db
Copy link
Contributor

@vladimirg-db vladimirg-db commented Apr 11, 2025

What changes were proposed in this pull request?

Turn file formats into case classes to properly compare them.

Why are the changes needed?

This is necessary to make LogicalRelations comparable when comparing single-pass and fixed-point Analyzer results.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests.

Was this patch authored or co-authored using generative AI tooling?

No.

@vladimirg-db vladimirg-db changed the title [SPARK-51773][SQL] Add hashCode and equals [SPARK-51773][SQL] Add hashCode and equals to file formats Apr 11, 2025
@@ -49,6 +49,10 @@ private[image] class ImageFileFormat extends FileFormat with DataSourceRegister

override def shortName(): String = "image"

override def hashCode(): Int = getClass.getCanonicalName.hashCode()

override def equals(other: Any): Boolean = other.isInstanceOf[ImageFileFormat]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, the options can be different. For example, dropInvalid can be enabled/disabled, which results in different outputs. Is this safe to assume that they are same?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The options is not in the instance of ImageFileFormat

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okie dokie

@cloud-fan
Copy link
Contributor

shall we simply turn them into case class?

@vladimirg-db vladimirg-db force-pushed the vladimir-golubev_data/add-hashcode-and-equals-to-file-formats branch from 8438735 to 2d2fa5c Compare April 14, 2025 12:01
@vladimirg-db vladimirg-db changed the title [SPARK-51773][SQL] Add hashCode and equals to file formats [SPARK-51773][SQL] Turn file formats into case classes to properly compare them Apr 14, 2025
@vladimirg-db
Copy link
Contributor Author

@cloud-fan hmm, might work, let me try that...

@vladimirg-db vladimirg-db force-pushed the vladimir-golubev_data/add-hashcode-and-equals-to-file-formats branch from 2d2fa5c to 1724a56 Compare April 14, 2025 18:37
@vladimirg-db
Copy link
Contributor Author

@cloud-fan I'm getting a weird documentation generation failure... Does that seem familiar to you?

@vladimirg-db vladimirg-db force-pushed the vladimir-golubev_data/add-hashcode-and-equals-to-file-formats branch from d349e91 to 85344e1 Compare April 15, 2025 14:21
@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 0a79406 Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants