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

[BUG]: dateformat 'YYYY-MM-DDTHH24:MI:SS.FF3Z' throwing error while executing the code in Databricks DBSQL #1188

Open
1 task done
ajinkya441 opened this issue Nov 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ajinkya441
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Category of Bug / Issue

Other

Current Behavior

Snowflake code input: to_char(pos.exec_time,'YYYY-MM-DDTHH24:MI:SS.FF3Z')
Databricks code output: TO_CHAR(pos.exec_time, 'YYYY-MM-DDTHH24:MI:SS.FF3Z')

Expected Behavior

Desired Databricks code output:
REPLACE(CONCAT(TO_CHAR(current_timestamp(), 'yyyy-MM-dd HH:mm:ss.SSS'), 'Z'), ' ', 'T')

Steps To Reproduce

  1. In snowflake environment
    select to_char(current_timestamp(),'YYYY-MM-DDTHH24:MI:SS.FF3Z'); --output : 2024-11-12T04:06:57.034Z

  2. In databtricks environmnet
    select TO_CHAR(pos.exec_time, 'YYYY-MM-DDTHH24:MI:SS.FF3Z'); -- error: --
    --[INCONSISTENT_BEHAVIOR_CROSS_VERSION.DATETIME_WEEK_BASED_PATTERN] You may get a different result due to
    --the upgrading to Spark >= 3.0: All week-based patterns are unsupported since Spark 3.0, detected week-based character: Y.
    --Please use the SQL function EXTRACT instead. SQLSTATE: 42K0B.

while
select REPLACE(CONCAT(TO_CHAR(current_timestamp(), 'yyyy-MM-dd HH:mm:ss.SSS'), 'Z'), ' ', 'T'); --output : 2024-11-12T04:06:57.034Z

Relevant log output or Exception details

No response

Sample Query

No response

Operating System

macOS

Version

latest via Databricks CLI

@ajinkya441 ajinkya441 added the bug Something isn't working label Nov 12, 2024
@sriram251-code sriram251-code self-assigned this Nov 15, 2024
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

No branches or pull requests

2 participants