Skip to content

[CRITEO] fix key issue while counting rows#164

Merged
jetoile merged 1 commit into
criteo-forks:criteo-3.5from
ichraf7:fix-partitionKey
Nov 6, 2025
Merged

[CRITEO] fix key issue while counting rows#164
jetoile merged 1 commit into
criteo-forks:criteo-3.5from
ichraf7:fix-partitionKey

Conversation

@ichraf7

@ichraf7 ichraf7 commented Nov 5, 2025

Copy link
Copy Markdown

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 statistics spark 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

@github-actions github-actions Bot added the SQL label Nov 5, 2025
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
@jetoile
jetoile merged commit 3e006d2 into criteo-forks:criteo-3.5 Nov 6, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants