• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

babelfish-for-postgresql / babelfish_extensions / 13999902845
77%

Build:
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 21 Mar 2025 08:33PM UTC
Jobs 1
Files 115
Run time 96min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Mar 2025 07:59PM UTC coverage: 75.112% (+0.06%) from 75.056%
13999902845

push

github

web-flow
Support for TSQL UNPIVOT Operator (#3431)

This PR implements TSQL UNPIVOT operator support in Babelfish by transforming it into equivalent PostgreSQL CROSS JOIN LATERAL operations. Currently, Babelfish does not support UNPIVOT operations. With this change, users can now use TSQL UNPIVOT syntax to transform wide-format data into long format.

UNPIVOT is a crucial TSQL feature used extensively in data transformation and analytics. Supporting this feature improves compatibility for migrating SQL Server applications to Babelfish.

The implementation adds TSQL UNPIVOT support through a multi-stage transformation approach.

At the parser stage, new grammar rules recognize TSQL UNPIVOT syntax and transform it into PostgreSQL's CROSS JOIN LATERAL structure by creating a JoinExpr node. This transformation also handles source table aliasing (if alias not present), and reassign the unpivot alias as the complete Join alias, returning the transformed node in a list with other metadata (unpivot identifier, unpivot alias, newly produced measure column etc).
At the analyzer stage, the unpivot hook function recursively processes the SelectStmt's fromClause tree to find and unwrap unpivot "List" nodes to make the query tree valid, whilst processing the other meta data from the node to create WHERE IS NOT NULL clause for the dimension column(s) (NULL exclusion (matching SQL Server's behavior)), and to handle SELECT * expansion by filtering out unpivot source columns.

Task: BABEL-4307
Signed-off-by: “manisha-deshpande” <“dmanisha.work@gmail.com”>

80 of 83 new or added lines in 1 file covered. (96.39%)

559 existing lines in 3 files now uncovered.

47762 of 63588 relevant lines covered (75.11%)

230604.18 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
84.56
0.57% contrib/babelfishpg_tsql/src/hooks.c

Uncovered Existing Lines

Lines Coverage ∆ File
2
76.03
-0.63% contrib/babelfishpg_tds/src/backend/tds/tdscomm.c
238
81.59
0.45% contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c
319
84.56
0.57% contrib/babelfishpg_tsql/src/hooks.c
Jobs
ID Job ID Ran Files Coverage
1 13999902845.1 21 Mar 2025 08:33PM UTC 115
75.11
GitHub Action Run
Source Files on build 13999902845
  • Tree
  • List 115
  • Changed 5
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #13999902845
  • d2c064b9 on github
  • Prev Build on BABEL_5_X_DEV (#13989101108)
  • Next Build on BABEL_5_X_DEV (#14078388999)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc