Skip to content

Conversation

@hantangwangd
Copy link
Member

@hantangwangd hantangwangd commented Oct 24, 2025

Description

We have separate HivePrestoToVeloxConnector to a standalone file in PR #26380. This PR makes some further refactor to let IcebergPrestoToVeloxConnector get rid of relying on HivePrestoToVeloxConnector.

toVeloxFileFormat(const presto::protocol::hive::StorageFormat& format) is a Hive connector specific function, thus move it into HivePrestoToVeloxConnector; while toHiveColumnType(protocol::hive::ColumnType type) is a common function used by Hive and Iceberg, thus move it into PrestoToVeloxConnectorUtils. This eliminates the need for IcebergPrestoToVeloxConnector to rely on the HivePrestoToVeloxConnector.

Motivation and Context

  • Decouple IcebergPrestoToVeloxConnector from HivePrestoToVeloxConnector

Impact

N/A

Test Plan

N/A

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

== NO RELEASE NOTE ==

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 24, 2025

Reviewer's Guide

Refactored function organization to decouple IcebergPrestoToVeloxConnector from HivePrestoToVeloxConnector by moving Hive-specific storage format conversions into the Hive connector, extracting common column type mapping into shared utilities, and updating includes accordingly.

Class diagram for refactored connector dependencies

classDiagram
    class HivePrestoToVeloxConnector {
        +toVeloxFileFormat(format: StorageFormat): FileFormat
    }
    class IcebergPrestoToVeloxConnector {
        // No longer depends on HivePrestoToVeloxConnector
    }
    class PrestoToVeloxConnectorUtils {
        +toHiveColumnType(type: ColumnType): HiveColumnHandle::ColumnType
    }
    HivePrestoToVeloxConnector --|> PrestoToVeloxConnector
    PrestoToVeloxConnectorUtils <.. IcebergPrestoToVeloxConnector : uses
    PrestoToVeloxConnectorUtils <.. HivePrestoToVeloxConnector : uses
Loading

Class diagram for function relocation and decoupling

classDiagram
    class HivePrestoToVeloxConnector {
        +toVeloxFileFormat(format: StorageFormat): FileFormat
    }
    class PrestoToVeloxConnectorUtils {
        +toHiveColumnType(type: ColumnType): HiveColumnHandle::ColumnType
    }
    HivePrestoToVeloxConnector -- PrestoToVeloxConnectorUtils : uses toHiveColumnType
Loading

File-Level Changes

Change Details Files
Relocate Hive-specific storage format conversion (toVeloxFileFormat) into the Hive connector
  • Removed toVeloxFileFormat implementation and declaration from PrestoToVeloxConnectorUtils
  • Added toVeloxFileFormat implementation in HivePrestoToVeloxConnector.cpp under the Hive connector namespace
  • Deleted corresponding declaration from PrestoToVeloxConnectorUtils.h
PrestoToVeloxConnectorUtils.cpp
PrestoToVeloxConnectorUtils.h
HivePrestoToVeloxConnector.cpp
Extract common Hive column type mapping (toHiveColumnType) into PrestoToVeloxConnectorUtils
  • Removed toHiveColumnType implementation from HivePrestoToVeloxConnector.cpp
  • Implemented toHiveColumnType in PrestoToVeloxConnectorUtils.cpp
  • Added toHiveColumnType declaration in PrestoToVeloxConnectorUtils.h
  • Stripped outdated toHiveColumnType declaration from HivePrestoToVeloxConnector.h
HivePrestoToVeloxConnector.cpp
PrestoToVeloxConnectorUtils.cpp
PrestoToVeloxConnectorUtils.h
HivePrestoToVeloxConnector.h
Decouple Iceberg connector and update includes to reflect function relocation
  • Removed include of HivePrestoToVeloxConnector.h from IcebergPrestoToVeloxConnector.cpp
  • Added velox/connectors/hive/TableHandle.h include in PrestoToVeloxConnectorUtils.h to support relocated types
  • Cleaned up obsolete declarations in HivePrestoToVeloxConnector.h
IcebergPrestoToVeloxConnector.cpp
PrestoToVeloxConnectorUtils.h
HivePrestoToVeloxConnector.h

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

@hantangwangd hantangwangd marked this pull request as ready for review October 24, 2025 11:23
@hantangwangd hantangwangd requested review from a team as code owners October 24, 2025 11:23
Copy link
Contributor

@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.

@hantangwangd
Copy link
Member Author

Hi @aditi-pandit @PingLiuPing, would you like to take a look at this? I think it might be better to further decouple Iceberg from HivePrestoToVeloxConnector. Any feedback would be greatly appreciated!

PingLiuPing
PingLiuPing previously approved these changes Oct 24, 2025
Copy link
Contributor

@PingLiuPing PingLiuPing left a comment

Choose a reason for hiding this comment

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

Thank you @hantangwangd

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @hantangwangd for the cleanup.


velox::dwio::common::FileFormat toVeloxFileFormat(
const presto::protocol::hive::StorageFormat& format);
velox::connector::hive::HiveColumnHandle::ColumnType toHiveColumnType(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would've liked to keep this file independent of all the Hive specific conversions. But seems like there are multiple of them in this file (toHiveTableHandle) etc . We could move them to their own separate file as well. What do you think of adding a HivePrestoToVeloxConnectorUtils as well ?

@PingLiuPing

Copy link
Member Author

Choose a reason for hiding this comment

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

I would've liked to keep this file independent of all the Hive specific conversions. But seems like there are multiple of them in this file (toHiveTableHandle) etc . We could move them to their own separate file as well.

Sounds great to me! Besides, for method toJsonString, since it is also used by PrestoToVeloxQueryPlan.cpp, perhaps it's worth considering moving it to the util class under package common.

@hantangwangd hantangwangd merged commit e20e45a into prestodb:master Oct 26, 2025
79 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