[CRITEO] fix key issue while counting rows#164
Merged
Conversation
Willymontaz
reviewed
Nov 5, 2025
ichraf7
force-pushed
the
fix-partitionKey
branch
from
November 6, 2025 08:45
df55ddb to
fc1de81
Compare
Say that dataset has hour as partition , hour is int and should be formatted in two digit format (hour=06) in metastore and inside spark rows is int, which create mismatch
ichraf7
force-pushed
the
fix-partitionKey
branch
from
November 6, 2025 12:56
fc1de81 to
2d46d4a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When hiveSerde is used (spark.sql.hive.convertInsertingPartitionedTable=false),
Say that dataset has hour as partition , hour is int and should be formatted in two digit format (hour=06) stored as int with padding inside metastore but rows inside the tables have it as int without the padding.
when
Analyze Table .. partition(hour='06') compute statisticsspark use the info inside the rows to generate row count of the given partition since hour is store without padding inside the table , so as spark infer rows to determine the partition key and it rows count it creates partition key that it is different then the one given in the input (that reflect what we have in metastore). Thus the created stats are never saved in metastore due to this format mismatch.When hiveSerde is not used we would like to keep the logic as it is since this use case will not happen
Why are the changes needed?
to fix the explained bug, and save the partition statistics
Does this PR introduce any user-facing change?
'No'.
How was this patch tested?
local build and test spark via mozart