Skip to content

[BUG]: Issue in MS SQL Server (incl. Synapse) converter, HASHBYTES function, incorrectly mapped arguments #2181

@PetrSmirnov

Description

@PetrSmirnov

Is there an existing issue for this?

  • I have searched the existing issues

Category of Bug / Issue

Converter bug

Current Behavior

In MS SQL Server (incl. Synapse) in SELECT statement function HASHBYTES('SHA2_256', expr) is converted to cast(sha2('SHA2_256', 256) as binary)which has incorrectly mapped arguments

Expected Behavior

We expect that it should be converted to cast(sha2(expr, 256) as binary)

Steps To Reproduce

No response

Relevant log output or Exception details

Logs Confirmation

  • I ran the command line with --debug
  • I have attached the lsp-server.log under USER_HOME/.databricks/labs/remorph-transpilers/<converter_name>/lib/lsp-server.log

Sample Query

SELECT  
HASHBYTES('SHA2_256', 'test string') AS row_hash

Operating System

Windows

Version

latest via Databricks CLI

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions