sql-formatter-org / sql-formatter-org/sql-formatter
spark ddl with struct data type error
Open
Nobody has claimed this yet.
bug
spark
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 456
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 3
Description
Describe the bug
When I execute show create table a in spark, I get the ddl sql as below:
CREATE TABLE t_a (
a bigint,
b struct <c: bigint>
)
There is a ':' that is optional between field name and field type.
Actual behavior
I input this sql in web demo.
There is a error.
An Unexpected Error Occurred
Parse error: Unexpected ": bigint> " at line 3 column 12. SQL dialect used: "spark".
Please report this at [Github issues page.](https://github.com/sql-formatter-org/sql-formatter/issues)
Stack Trace:
Error: Parse error: Unexpected ": bigint>
" at line 3 column 12.
SQL dialect used: "spark".
at T.default.createParseError (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:235390)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:235156)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:230135)
at T.default.tokenize (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:245337)
at T.default.reset (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:243864)
at T.O.feed (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:270080)
at Object.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:245475)
at T.default.parse (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16428)
at T.default.format (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:16326)
at T.formatDialect (https://unpkg.com/sql-formatter@latest/dist/sql-formatter.min.js:1:264877)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the shown CREATE TABLE statement in the web demo using the Spark dialect and start at the Spark parser entry point indicated by the error. Trace how the struct field declaration is parsed, then verify that the reported DDL formats successfully without the unexpected colon error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- spark, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100