Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TSQL PIVOT operator #165

Conversation

RIC06X
Copy link
Contributor

@RIC06X RIC06X commented Jul 27, 2023

Description

This PR brings PIVOT operator to Babelfish.

Issues Resolved

Task: BABEL-284

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the PostgreSQL license, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@RIC06X RIC06X marked this pull request as draft October 23, 2023 18:55
@RIC06X RIC06X marked this pull request as ready for review October 26, 2023 23:23
@RIC06X RIC06X requested a review from forestkeeper October 27, 2023 17:13
@RIC06X RIC06X self-assigned this Oct 27, 2023
@RIC06X RIC06X requested a review from lejaokri October 27, 2023 17:32
Comment on lines +1758 to +1763
bool isPivot;
struct SelectStmt *srcSql;
struct SelectStmt *catSql;
List *value_col_strlist;
char *pivotCol;
Node *aggFunc;
Copy link
Contributor

@lejaokri lejaokri Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are adding in new fields to SelectStmt please refer to the following fix by @timchang514 where he fixed a problem with uninitialized value when copying these types of structs. Please check if you need to do the same.

commit 26b4e995d4b69e934c511019ee2175a31227c56a
Author: Tim Chang <[email protected]>
Date:   Mon Sep 25 15:14:17 2023 -0400

    Add new fields to IntoClause funcs to avoid issues with uninitialized memory. (#219)

    Signed-off-by: Tim Chang <[email protected]>

Also, I found your branch based on a really old commit. You may need to rebase.

Add a boolean isPivot in SelectStmt to check if it is a pivot select

Task: BABEL-284
Signed-off-by: Yanjie Xu <[email protected]>
Added transformPivotClause function in analyer to help identify output
table columns' data type.

Task: BABEL-284
Signed-off-by: Yanjie Xu <[email protected]>
Refactor code from engine to extension

Task: BABEL-284
Signed-off-by: Yanjie Xu <[email protected]>
@forestkeeper forestkeeper merged commit ed8d6d1 into babelfish-for-postgresql:BABEL_3_X_DEV__PG_15_X Oct 28, 2023
2 checks passed
Sairakan pushed a commit to amazon-aurora/postgresql_modified_for_babelfish that referenced this pull request Nov 16, 2023
Add support for PIVOT in babelfish

Task: BABEL-284
Signed-off-by: Yanjie Xu <[email protected]>
priyansx pushed a commit to amazon-aurora/postgresql_modified_for_babelfish that referenced this pull request Nov 22, 2023
Add support for PIVOT in babelfish

Task: BABEL-284
Signed-off-by: Yanjie Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants