Skip to content
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

Uniform: Fix microsecond conversion for timestamp/ntz partition value #4195

Merged

Conversation

amogh-jahagirdar
Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar commented Feb 27, 2025

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

When converting timestamp partition values from Delta to Iceberg, currently we're doing the microsecond conversion incorectly. This leads to every conversion just returning the Unix epoch timestamp.

In the current approach we're using some utilities from Iceberg, such as DateTimeUtil.microsFromInstant which already have implemented this logic correctly.

There were unit tests that should've caught this earlier by testing the Iceberg spark session as a reader, but they were passing just because the wrong read method was used. This PR fixes that as well.

How was this patch tested?

I fixed existing unit tests since they should've caught this.

Does this PR introduce any user-facing changes?

@amogh-jahagirdar amogh-jahagirdar force-pushed the fix-iceberg-micro-conversion branch from 2cbe206 to 6717552 Compare February 27, 2025 06:27
@@ -83,7 +83,7 @@ abstract class UniFormE2EIcebergSuiteBase extends UniFormE2ETest {
s"where ${partitionColumnName}=${partitionColumnsAndValues._2}"
// Verify against Delta read and Iceberg read
checkAnswer(spark.sql(verificationQuery), Seq(Row(123)))
checkAnswer(createReaderSparkSession.sql(verificationQuery), Seq(Row(123)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's important to go through the read function, for some reason when I go through createReaderSparkSession directly that doesn't actually use the Iceberg spark session even though we are overriding it correctly.

@amogh-jahagirdar amogh-jahagirdar force-pushed the fix-iceberg-micro-conversion branch from 6717552 to 3755e1a Compare February 27, 2025 07:06
@vkorukanti vkorukanti merged commit 9d422c4 into delta-io:master Feb 27, 2025
18 of 21 checks passed
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.

3 participants