sql-formatter-org / sql-formatter-org/sql-formatter

Formatter doesn't recognize Hive CREATE TABLE modifiers

Open
#797 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug hive
Dominant language
TypeScript
Stars
2.9k
Forks
456
Avg merge
3d 4h
Merged PRs (30d)
3

Description

Input data

Which SQL and options did you provide as input?


CREATE TABLE k8s_demos.dd_dd_dd 
(id string COMMENT 'd', name string COMMENT 'name') 
using paimon COMMENT '122' TBLPROPERTIES (
  'compression' = 'ZSTD',
  'bizOwner' = 'huaixin',
  'dataLevel' = 'P3',
  'dwClassification' = '',
  'subject1' = '',
  'subject2' = '',
  'primary-key' = 'id'
) lifeCycle 122;

Expected Output


CREATE TABLE k8s_demos.dd_dd_dd (
  id string COMMENT 'd', 
  name string COMMENT 'name'
) 
using paimon 
COMMENT '122' 
TBLPROPERTIES (
  'compression' = 'ZSTD',
  'primary-key' = 'id'
) lifeCycle 122;

Actual Output

CREATE TABLE k8s_demos.dd_dd_dd (id string COMMENT 'd', name string COMMENT 'name') using paimon COMMENT '122' TBLPROPERTIES (
  'compression' = 'ZSTD',
  'bizOwner' = 'huaixin',
  'dataLevel' = 'P3',
  'dwClassification' = '',
  'subject1' = '',
  'subject2' = '',
  'primary-key' = 'id'
) lifeCycle 122;

Usage

  • How are you calling / using the library?
  • What SQL language(s) does this apply to?
  • Which SQL Formatter version are you using?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied Hive CREATE TABLE statement in the formatter and trace the parsing and formatting path for CREATE TABLE modifiers. Add a regression test using the reported input and expected output, then verify that the formatter preserves the modifiers while producing the requested layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.