Skip to content

Conversation

smkniazi
Copy link

@smkniazi smkniazi commented Oct 9, 2025

Description

The current implementation throws an error for empty directories, which does not conform to the specifications defined here and here.

With this change, it returns an empty list if the directory is empty and throws an error only if the directory does not exist.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

Copy link

cla-bot bot commented Oct 9, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

Copy link

sourcery-ai bot commented Oct 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR refactors TrinoHudiStorage’s listing methods to conform with Hudi’s API: it now explicitly checks for path existence before listing and returns empty collections for empty directories, only throwing errors when the path is truly missing.

Class diagram for updated TrinoHudiStorage listing methods

classDiagram
class TrinoHudiStorage {
    +boolean createDirectory(StoragePath path)
    +List<StoragePathInfo> listDirectEntries(StoragePath path)
    +List<StoragePathInfo> listDirectEntries(StoragePath path, StoragePathFilter filter)
    +List<StoragePathInfo> listFiles(StoragePath path)
}
TrinoHudiStorage --> FileSystem : uses
TrinoHudiStorage --> FileIterator : uses
TrinoHudiStorage --> StoragePathInfo : returns
TrinoHudiStorage --> StoragePath : parameter
TrinoHudiStorage --> StoragePathFilter : parameter (filtered listing)
Loading

File-Level Changes

Change Details Files
Add explicit existence check for storage paths
  • Introduce exists(path) guard at the start of both listDirectEntries overloads
  • Throw FileNotFoundException when the path does not exist
plugin/trino-hudi/src/main/java/io/trino/plugin/hudi/storage/TrinoHudiStorage.java
Allow empty directory listings without error
  • Remove the conditional that threw FileNotFoundException when no entries were found
  • Eliminate the entry-counting logic tied to the empty-directory exception
plugin/trino-hudi/src/main/java/io/trino/plugin/hudi/storage/TrinoHudiStorage.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We failed to fetch pull request #26897.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@github-actions github-actions bot added the hudi Hudi connector label Oct 9, 2025
Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

Could you add a test?

@ebyhr
Copy link
Member

ebyhr commented Oct 10, 2025

Fixed the handling of empty directories in TrinoHudiStorage.

Please follow our commit message guideline: https://trino.io/development/process.html#pull-request-and-commit-guidelines-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hudi Hudi connector

Development

Successfully merging this pull request may close these issues.

2 participants