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

[HUDI-6048] Check if partition exists before list partition by path prefix #8402

Merged
merged 2 commits into from
Apr 14, 2023

Conversation

Zouxxyy
Copy link
Contributor

@Zouxxyy Zouxxyy commented Apr 7, 2023

Change Logs

Currently, in tryListByPartitionPathPrefix, when the prefix search condition is met, it will directly return or search without judging whether the directory exists.

When metadata is not used, an exception will be thrown when querying non-existing partitions, for example:

create table hudi_cow_test_tbl (
  id bigint,
  name string,
  ts bigint,
  dt string,
  hh string
) using hudi
tblproperties (
  type = 'cow',
  primaryKey = 'id',
  preCombineField = 'ts',
  'hoodie.metadata.enable' = 'false'
)
partitioned by (dt, hh);

select * from hudi_cow_test_tbl where dt='xxx';

ERROR Executor: Exception in task 0.0 in stage 8.0 (TID 10)
java.io.FileNotFoundException: File file:/hudi_cow_test_tbl/dt=xxx does not exist

Impact

When metadata is disabled and PartitionPathPrefixAnalysis is enabled, no exception will be thrown when querying non-existing partitions

Risk level (write none, low medium or high below)

low

Documentation Update

none

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@Zouxxyy
Copy link
Contributor Author

Zouxxyy commented Apr 7, 2023

@yihua @YuweiXiao Can you help with a review~

@hudi-bot
Copy link

hudi-bot commented Apr 7, 2023

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Copy link
Contributor

@YuweiXiao YuweiXiao left a comment

Choose a reason for hiding this comment

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

looks good overall. Thanks for contribution!

(Seq(EqualTo(attribute("region_code"), literal("0"))),
"region_code = '0'",
enablePartitionPathPrefixAnalysis,
Seq())
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the test still pass if we do not apply the fix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@danny0405 when enableMetadataTable = false, enablePartitionPathPrefixAnalysis = true, can't pass

Copy link
Member

@SteNicholas SteNicholas left a comment

Choose a reason for hiding this comment

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

LGTM. I have cherried pick into internal version and tested whether to work well.

@codope codope merged commit 657b837 into apache:master Apr 14, 2023
stayrascal pushed a commit to stayrascal/hudi that referenced this pull request Apr 20, 2023
yihua pushed a commit to yihua/hudi that referenced this pull request May 15, 2023
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.

None yet

8 participants