Skip to content

[GLUTEN-7589][VL] Support date_trunc function#7611

Merged
zhouyuan merged 2 commits intoapache:mainfrom
zml1206:GLUTEN-7589
Apr 18, 2025
Merged

[GLUTEN-7589][VL] Support date_trunc function#7611
zhouyuan merged 2 commits intoapache:mainfrom
zml1206:GLUTEN-7589

Conversation

@zml1206
Copy link
Contributor

@zml1206 zml1206 commented Oct 19, 2024

What changes were proposed in this pull request?

Fixes: #7589

How was this patch tested?

@zml1206 zml1206 marked this pull request as draft October 19, 2024 05:42
@github-actions github-actions bot added CORE works for Gluten Core BUILD VELOX DOCS labels Oct 19, 2024
@github-actions
Copy link

#7589

@github-actions
Copy link

Run Gluten Clickhouse CI

1 similar comment
@github-actions
Copy link

Run Gluten Clickhouse CI

@github-actions
Copy link

github-actions bot commented Dec 4, 2024

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale stale label Dec 4, 2024
@github-actions
Copy link

This PR was auto-closed because it has been stalled for 10 days with no activity. Please feel free to reopen if it is still valid. Thanks.

@github-actions github-actions bot closed this Dec 15, 2024
@ayushi-agarwal
Copy link
Contributor

@zml1206 Do you plan to reopen this to support date_trunc function in gluten?

@zml1206
Copy link
Contributor Author

zml1206 commented Apr 1, 2025

@zml1206 Do you plan to reopen this to support date_trunc function in gluten?

After this PR(facebookincubator/velox#11340) is merged, I will open a new PR to support it.

}
}

test("date_trunc") {
Copy link
Contributor

Choose a reason for hiding this comment

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

@zml1206 I was running part of this test by using your velox changes and it was giving incorrect result for year
Output for this 2015-07-22 10:01:40.123456 was coming to be 2014-12-31 16:00:00.0 instead of 2015-01-01 00:00:00.0
It may be due to timezone conversion, could you suggest if I am missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

withSQLConf(SQLConf.SESSION_LOCAL_TIMEZONE.key -> "UTC")

Copy link
Contributor

@ayushi-agarwal ayushi-agarwal Apr 2, 2025

Choose a reason for hiding this comment

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

I had tried setting this and it gives correct results but I was confused that for a real workload also do we need to set it? Will setting of this config not be needed if we pass timezone also to this function?
From velox side I see that in call method of this function, timeZone_ comes out to be a nullptr, but gluten passes spark.sql.session.timeZone to velox as query config so I am confused as to why it comes to be a nullptr? Could you please share light on it as I am new to the timestamp part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Here it comes to be nullptr when I added a logline to prine timezone, that's what caused the confusion.

Copy link
Contributor Author

@zml1206 zml1206 Apr 2, 2025

Choose a reason for hiding this comment

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

image

I have no problem here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, then it seems some issue in my environment due to which it comes out to be null.

Copy link
Contributor

Choose a reason for hiding this comment

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

For me initialize function was never getting called when I was running test from gluten, after changing the definition of initialize to this it is working fine.
FOLLY_ALWAYS_INLINE void initialize(
const std::vector& /inputTypes/,
const core::QueryConfig& config,
const arg_type* /unitString/,
const arg_type* /timestamp/) {
std::cout << "Initializing DateTruncFunction" << std::endl;
timeZone_ = getTimeZoneFromConfig(config);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, my mistake, thank you.

@zhouyuan
Copy link
Member

zhouyuan commented Apr 3, 2025

hi @zml1206
date_trunc is merged in velox, would you re-open this patch?
#9213

thanks, -yuan

@zhouyuan zhouyuan removed the stale stale label Apr 3, 2025
@zml1206 zml1206 reopened this Apr 4, 2025
@github-actions github-actions bot removed CORE works for Gluten Core BUILD DOCS labels Apr 4, 2025
@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Run Gluten Clickhouse CI on x86

@github-actions github-actions bot added the CORE works for Gluten Core label Apr 4, 2025
@github-actions
Copy link

github-actions bot commented Apr 4, 2025

Run Gluten Clickhouse CI on x86

@github-actions
Copy link

Run Gluten Clickhouse CI on x86

@zml1206 zml1206 marked this pull request as ready for review April 18, 2025 00:39
@zml1206 zml1206 requested a review from zhouyuan April 18, 2025 01:12
Copy link
Member

@zhouyuan zhouyuan left a comment

Choose a reason for hiding this comment

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

Thanks.

@zhouyuan zhouyuan merged commit f74d31c into apache:main Apr 18, 2025
47 checks passed
@zml1206 zml1206 deleted the GLUTEN-7589 branch December 9, 2025 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[VL] Support date_trunc function

3 participants