Skip to content

EnableBatchedInserts strips backtick quoting from column names containing dots #1284

@o-shevchenko

Description

@o-shevchenko

Description

When EnableBatchedInserts=1 is set as a JDBC connection property, the Databricks JDBC driver strips backtick quoting from column names during its internal SQL reconstruction in PreparedStatementBatchExecutor.executeBatchedInsert(). This causes PARSE_SYNTAX_ERROR for column names containing dots (e.g., col.name), as the unquoted dot is interpreted as a schema/table separator.

Steps to Reproduce

  1. Connect to Databricks using JDBC with EnableBatchedInserts=1
  2. Create a table with column names containing dots (e.g., col.name)
  3. Use PreparedStatement.addBatch() + executeBatch() to insert data into the table

Expected Behavior

The driver should preserve backtick quoting around column names when reconstructing the batched INSERT SQL:

INSERT INTO `table` (`col.name`, `col2`) VALUES (?, ?), (?, ?), ...

Actual Behavior

The driver strips backtick quoting from column names during SQL reconstruction:

INSERT INTO `table` (col.name, col2) VALUES (?, ?), (?, ?), ...

This results in:

[PARSE_SYNTAX_ERROR] Syntax error at or near 'name'. SQLSTATE: 42601

Environment

  • Databricks JDBC Driver v3.x
  • Connection properties: EnableBatchedInserts=1, BatchInsertSize=10000
  • jOOQ with SQLDialect.DATABRICKS (generates correct backtick-quoted SQL)

Workaround

Currently, the only workaround is to disable EnableBatchedInserts, which results in ~10x slower write performance (e.g., 141s vs 12s for 100 records).

Additional Context

The issue is in the driver's PreparedStatementBatchExecutor.executeBatchedInsert() method, which parses the original INSERT statement, extracts column names (stripping backticks), and reconstructs a multi-row INSERT without re-quoting identifiers that require it.

This affects any column name containing special characters that require quoting (dots, spaces, reserved words, etc.).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions