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

babelfish-for-postgresql / babelfish_extensions / 14003131597
76%
BABEL_5_X_DEV: 77%

Build:
Build:
LAST BUILD BRANCH: fix_script_injection
DEFAULT BRANCH: BABEL_5_X_DEV
Ran 22 Mar 2025 12:49AM UTC
Jobs 1
Files 115
Run time 1min
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

22 Mar 2025 12:16AM UTC coverage: 75.041% (+0.03%) from 75.013%
14003131597

push

github

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

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%)

47612 of 63448 relevant lines covered (75.04%)

193480.58 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
84.79
0.4% contrib/babelfishpg_tsql/src/hooks.c
Jobs
ID Job ID Ran Files Coverage
1 14003131597.1 22 Mar 2025 12:49AM UTC 115
75.04
GitHub Action Run
Source Files on build 14003131597
  • Tree
  • List 115
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #14003131597
  • a6777e39 on github
  • Prev Build on BABEL_4_X_DEV (#13996454998)
  • Next Build on BABEL_4_X_DEV (#14027548511)
  • 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