Skip to content

[FORMATTING] Spark SQL table aliase includes "set" will be depart #881

@Dongchuan12

Description

@Dongchuan12

Input data

Which SQL and options did you provide as input?

select
    *
from
    (
        select
            *
        from
            a
    ) t1_set
    left join (
        select
            *
        from
            b
    ) t2_set on t1_set.id = t2_set.id;

Expected Output

select
    *
from
    (
        select
            *
        from
            a
    ) t1_set
left join (
    select
        *
    from
        b
) t2_set on t1_set.id = t2_set.id;

Actual Output

select
    *
from
    (
        select
            *
        from
            a
    ) t1_ set
left join (
    select
        *
    from
        b
) t2_set on t1_set.id = t2_set.id;

The first table alias "t1_set" includes string "set" was departed after format
If the table alias uses "t1set" will also be depart

Usage

  • How are you calling / using the library?
import { format as sqlFormatter } from 'sql-formatter';

 let formatValue = sqlFormatter(value, {
            language: SQL_MAP[this.type] || this.type,
            tabWidth: 4, // 缩进设置为4
          });
  • What SQL language(s) does this apply to?
    spark
  • Which SQL Formatter version are you using?
    15.3.1

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