Skip to content

Arrow symbole in Spark queries using lambda like functions ex: array_sort #176

Closed
@cccs-jc

Description

@cccs-jc

Spark supports functions which take a "lambda like" function. Here's an example using array_sort

SELECT
  array_sort(
    ARRAY('bc', 'ab', 'dc'),
    (left, right) -> CASE
      WHEN left IS NULL
      AND right IS NULL THEN 0
      WHEN left IS NULL THEN -1
      WHEN right IS NULL THEN 1
      WHEN left < right THEN 1
      WHEN left > right THEN -1
      ELSE 0
    END
  );

https://spark.apache.org/docs/latest/api/sql/index.html

The issue is that sql-formatter will split the arrow -> into - >

I will fix this issue and submit a PR. Any guidance on how to best fix this is much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions