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

Add sessionTimezone and adjustTimestampToTimezone to DWRF reader and writer options #10895

Closed
wants to merge 1 commit into from

Conversation

wypb
Copy link
Contributor

@wypb wypb commented Aug 30, 2024

As suggested here This PR refactors the DRWF Reader and Writer related APIs so that we can get sessionTimezone and adjustTimestampToTimezone in DRWF's ColumnWriter and ColumnReader. No functionality change.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2024
Copy link

netlify bot commented Aug 30, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 11541d0
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/670742c8405e8c00081ad7a7

@wypb wypb force-pushed the refactor_dwrf_api branch 3 times, most recently from d8e0416 to bb946f5 Compare August 30, 2024 05:08
@Yuhta Yuhta changed the title Refactor DWRF read and write related APIs Add sessionTimezone and adjustTimestampToTimezone to DWRF reader and writer options Aug 30, 2024
@wypb wypb force-pushed the refactor_dwrf_api branch 4 times, most recently from e9ff5b5 to 331b771 Compare September 3, 2024 03:30
@Yuhta Yuhta added the ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall label Sep 5, 2024
@wypb
Copy link
Contributor Author

wypb commented Sep 6, 2024

@Yuhta The new commit resolves the conflict with the main branch. Please review it again if necessary.

@mbasmanova
Copy link
Contributor

@wypb Would you rebase this PR so we can merge it?

@wypb wypb force-pushed the refactor_dwrf_api branch 3 times, most recently from f7dda0a to b356a66 Compare September 9, 2024 10:57
@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@wypb
Copy link
Contributor Author

wypb commented Sep 9, 2024

@wypb Would you rebase this PR so we can merge it?

@mbasmanova I have synced the latest code, thanks.

@facebook-github-bot
Copy link
Contributor

@mbasmanova has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@Yuhta
Copy link
Contributor

Yuhta commented Sep 9, 2024

@wypb Can you rebase to the latest main so we can merge it?

@wypb
Copy link
Contributor Author

wypb commented Sep 9, 2024

Hi @Yuhta I have synced the latest code.

@wypb wypb force-pushed the refactor_dwrf_api branch 4 times, most recently from 04a1e1f to 029a035 Compare September 10, 2024 06:31
@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.


/// Creates reader base from metadata.
ReaderBase(
memory::MemoryPool& pool,
const dwio::common::ReaderOptions& options,
Copy link
Contributor

Choose a reason for hiding this comment

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

This signature is used in other integration inside Meta so cannot be changed

Copy link
Contributor Author

@wypb wypb Sep 24, 2024

Choose a reason for hiding this comment

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

Hi @Yuhta I have rolled back this part of the code.

There is a CI that turns red and is related to this

@wypb wypb force-pushed the refactor_dwrf_api branch 2 times, most recently from 65e360e to 2813162 Compare September 24, 2024 02:08
@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

memory::MemoryPool& pool,
std::unique_ptr<dwio::common::BufferedInput> input,
dwio::common::FileFormat fileFormat);
const dwio::common::ReaderOptions& options,
Copy link
Contributor

@Yuhta Yuhta Sep 25, 2024

Choose a reason for hiding this comment

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

@wypb We also need another one for ReaderBase(memory::MemoryPool&, std::unique_ptr<dwio::common::BufferedInput>) (and possibly the following default arguments, but let's create this one first)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Yuhta I have rolled back this part of the code. Please help me review it, thank you.

Copy link
Contributor

Choose a reason for hiding this comment

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

We are missing one for

ReaderBase(
      memory::MemoryPool& pool,
      std::unique_ptr<dwio::common::BufferedInput> input)

Could be just adding a default argument for fileFormat in the signature below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @Yuhta Sorry, I misunderstood, I have already given a default value to the fileFormat parameter. Please help me review it, thank you.

@wypb wypb force-pushed the refactor_dwrf_api branch 2 times, most recently from 05a1673 to 4112cf3 Compare September 27, 2024 02:56
@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@wypb thanks for change % nits.

/// Whether to adjust Timestamp to the timeZone obtained through
/// sessionTimezone(). This is used to be compatible with the
/// old logic of Presto.
const bool adjustTimestampToTimezone() const {
Copy link
Contributor

Choose a reason for hiding this comment

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

drop const

@@ -378,6 +387,7 @@ class ConnectorQueryCtx {
const int driverId_;
const std::string planNodeId_;
const std::string sessionTimezone_;
bool adjustTimestampToTimezone_;
Copy link
Contributor

Choose a reason for hiding this comment

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

add const here

@@ -744,6 +744,13 @@ uint32_t HiveDataSink::appendWriter(const HiveWriterId& id) {
connectorSessionProperties,
options);

const auto& sessionTzName = connectorQueryCtx_->sessionTimezone();
Copy link
Contributor

Choose a reason for hiding this comment

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

s/sessionTzName/sessionTimeZoneName/

return options;
}

const dwio::common::ReaderOptions options_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you move const member first? Thanks!

@@ -103,6 +103,18 @@ class StripeStreams {
*/
virtual const dwio::common::ColumnSelector& getColumnSelector() const = 0;

/**
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use /// for comments to be consistent with other code places? Thanks!

@wypb
Copy link
Contributor Author

wypb commented Oct 9, 2024

Hi @xiaoxmeng Addressed all the comments, can you help review again? Thanks!

@Yuhta
Copy link
Contributor

Yuhta commented Oct 9, 2024

@wypb There are some build errors

@wypb wypb force-pushed the refactor_dwrf_api branch 2 times, most recently from 5735935 to 14dda78 Compare October 10, 2024 01:35
@wypb
Copy link
Contributor Author

wypb commented Oct 10, 2024

@wypb There are some build errors

@Yuhta I've already fixed it, thank you for your reply.

@facebook-github-bot
Copy link
Contributor

@Yuhta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@Yuhta merged this pull request in 900e61c.

Copy link

Conbench analyzed the 1 benchmark run on commit 900e61c4.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged ready-to-merge PR that have been reviewed and are ready for merging. PRs with this tag notify the Velox Meta oncall
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants