Skip to content

[FORMATTING] Several documented operators are split or rejected in DuckDB, Spark, Redshift, and T-SQL #1008

Closed

Description

@trackoor

Input data

Which SQL and options did you provide as input?

// npm i [email protected]
const { format } = require('sql-formatter');

// 1. DuckDB: list overlap (&&), array distance (<->), list contains (@>, <@)
console.log(format('SELECT [1, 2, 3] && [3, 4], a <-> b', { language: 'duckdb' }));
format('SELECT [1, 2, 3] @> [1]', { language: 'duckdb' });
format('SELECT [1] <@ [1, 2]', { language: 'duckdb' });

// 2. Spark: bitwise shifts (<<, >>, >>>), named argument (=>), cast (::)
console.log(format('SELECT a << 1, a >> 1, a >>> 1, f(x => 1)', { language: 'spark' }));
format('SELECT a::INT', { language: 'spark' });

// 3. Redshift: LIKE synonym (~~) and negated POSIX regex (!~)
console.log(format('SELECT a ~~ b', { language: 'redshift' }));
format('SELECT a !~ b', { language: 'redshift' });

// 4. Transact-SQL: string concatenation (||)
console.log(format("SELECT 'SQL ' || 'Server'", { language: 'transactsql' }));

Expected Output

-- 1. DuckDB
SELECT
  [1, 2, 3] && [3, 4],
  a <-> b

SELECT
  [1, 2, 3] @> [1]

SELECT
  [1] <@ [1, 2]

-- 2. Spark
SELECT
  a << 1,
  a >> 1,
  a >>> 1,
  f (x => 1)

SELECT
  a::INT

-- 3. Redshift
SELECT
  a ~~ b

SELECT
  a !~ b

-- 4. Transact-SQL
SELECT
  'SQL ' || 'Server'

Actual Output

-- 1. DuckDB
SELECT
  [1, 2, 3] & & [3, 4],
  a < -> b
-- Parse error: Unexpected "@> [1]" at line 1 column 18. SQL dialect used: "duckdb".
-- Parse error: Unexpected "@ [1, 2]" at line 1 column 13. SQL dialect used: "duckdb".

-- 2. Spark
SELECT
  a < < 1,
  a > > 1,
  a > > > 1,
  f (x = > 1)
-- Parse error: Unexpected "::INT" at line 1 column 9. SQL dialect used: "spark".

-- 3. Redshift
SELECT
  a ~ ~ b
-- Parse error: Unexpected "!~ b" at line 1 column 10. SQL dialect used: "redshift".

-- 4. Transact-SQL
SELECT
  'SQL ' | | 'Server'

Usage

Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.

Credit: https://ucsbplse.github.io/

Activity

  1. added a commit that references this issue on Nov 18, 2026
    d2e6a98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions