Closed benjamin-awd closed 10 months ago
We support similar syntax for structs amd arrays in BQ. I think we may just have to add the "map" keyword into that lever.
Raised a PR https://github.com/tconbeer/sqlfmt/pull/503
So apparently sqlfluff lints map<...>
statements, and actually expects something like this:
select cast(json_parse(foo) as array<map <varchar, varchar>>) from dwh.table
(note the additional whitespace in front of map)
The specific sqfluff rule is:
L: 57 | P: 57 | LT01 | Expected single whitespace between 'map' keyword and
| start angle bracket '<'. [layout.spacing]
Not sure if the best solution here is to simply ignore the layout.spacing
rule
Yeah that makes no sense to have a space after map but not array. I'd ignore that rule.
Describe the bug Athena has array and map datatypes, that use
<
and>
characters. Running sqlfmt on queries that use these types produce unexpected behaviour.Expected behavior
Actual behavior Strange spacing in between < and > separators
Additional context What is the output of
sqlfmt --version
?Note: non-breaking, but not ideal