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

YYYY-MM-DD HH: mm format date string cast to date returns null object, result is incorrect #837

Closed
wsk1314zwr opened this issue Feb 19, 2025 · 3 comments · Fixed by #838
Closed
Labels
bug Something isn't working

Comments

@wsk1314zwr
Copy link

Describe the bug

When the Blaze switch is turned on, the YYYY-MM-DD HH: mm format date string cast to date returns a null object This is inconsistent with the result of Spark without Blaze enabled.

To Reproduce
Steps to reproduce the behavior:

-- one : create table
CREATE TABLE default.test_01 (
  access_time STRING COMMENT '最近访问时间')
stored as orc;

-- two:insert data with YYYY-MM-DD HH: mm format
insert overwrite default.test_01 values('2022-03-22 22:27')

-- three:open blaze
set spark.blaze.enable=true;

-- four: select
select 
access_time,cast('2022-03-22 22:27' as date),cast(access_time as date)
from default.test_01 ;

-- The return result is as follows: the second and third columns have the same input, but different outputs
access_time      | CAST(2022-03-22 22:27 AS DATE) | access_time
2022-03-22 22:27 | 2022-03-22                     |  null

Expected behavior

Looking forward to receiving the correct results

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Spark3.4.3

@richox richox added the bug Something isn't working label Feb 19, 2025
@lsyulong
Copy link

@richox Hi, I would like to give it a try, but I'm not sure which part to modify. Can you help me with this? I'll research it out

@harveyyue
Copy link
Contributor

@richox Hi, I would like to give it a try, but I'm not sure which part to modify. Can you help me with this? I'll research it out

@lsyulong Fallback cast date type to SparkUDFWrapper function will fix this issue.

@lsyulong
Copy link

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants