Window functions is not recognized by SQL formatter

Answered

Hi,

I have issues with the code style:

SELECT
location_international_customers AS place
, SUM(price) over (PARTITION BY location, start_time ORDER start_time) AS dollars
, item
FROM
raw_data

The word "over" is not recognized as a keyword or changed into uppercase. "over" seems to be recognized as a column name and it aligns it with other column names (after AS).

Having several window functions in the same makes the other rows not to be aligned (beginning commas aligned).

0
5 comments

Jaolaza,

Could you specify you SQL dialect and share your formatter settings?

0

I'm using the General SQL code style.

Formatter settings, do you mean all the formatting config tabs?

There is no section for window functions.

 

0

Jaolaza,

I mean, do you work with PostgreSQL or similar RDBMS?

To import formatter settings you just need to export them

0

I'm using the Trino driver.

 

My formatting export is:

<code_scheme name="Default" version="173">
<SqlCodeStyleSettings version="5">
<option name="KEYWORD_CASE" value="2" />
<option name="TYPE_CASE" value="2" />
<option name="QUERY_EL_LINE" value="101" />
<option name="QUERY_EL_COMMA" value="1" />
<option name="WITH_EL_LINE" value="101" />
<option name="WITH_EL_COMMA" value="1" />
<option name="FROM_WRAP_ON" value="true" />
</SqlCodeStyleSettings>
</code_scheme>

0

Jaolaza,

I submitted an issue DBE-13749 based on your description to follow and up vote.

 

0

Please sign in to leave a comment.