Skip to content

[BUG] Redundant backticks in setSchema and setCatalog #1453

@no23reason

Description

@no23reason

Describe the bug
After the changes implemented in #1146 what previously worked: passing a backtick-quoted value, now breaks with INVALID_SET_SYNTAX as the identifier ends up double-quoted.

To Reproduce
Call setCatalog or setSchema with a value wrapped in backticks like

"`foo-bar`" 

and then use the connection. It fails with:

org.apache.hive.service.cli.HiveSQLException: Error running query: [INVALID_SET_SYNTAX] org.apache.spark.sql.catalyst.parser.ParseException: 
[INVALID_SET_SYNTAX] Expected format is 'SET', 'SET key', or 'SET key=value'. If you want to include special characters in key, or include semicolon in value, please use backquotes, e.g., SET `key`=`value`. SQLSTATE: 42000
== SQL (line 1, position 1) ==
SET CATALOG ``foo-bar``

Expected behavior
The identifier should not end up being double quoted. This worked fine on driver version 2.7.6 and older.

Client Environment (please complete the following information):

  • OS Linux
  • Java version Java 21
  • Java vendor OpenJDK
  • Driver Version 3.3.3

Additional context
The changes implemented in #1146 do not properly support already backticked values. If the value is already backticked (which I believe is a valid case as per the Naming section of the docs), it should prevent wrapping it again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions