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

Make gp-style partition table compatible with greenplum #695

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

gfphoenix78
Copy link
Contributor

Adding a new partition should have the same behavior like greenplum 6/7.
The child partition inherits access method, reloptions, column encodings
from its parent if no specific options are provided


Change logs

Describe your change clearly, including what problem is being solved or what feature is being added.

If it has some breaking backward or forward compatibility, please clary.

Why are the changes needed?

Describe why the changes are necessary.

Does this PR introduce any user-facing change?

If yes, please clarify the previous behavior and the change this PR proposes.

How was this patch tested?

CREATE TABLE star.trd_fct (
trd_date_key date NOT NULL ,
prod_key integer NOT NULL ,
cust_key integer NOT NULL ,
notional_val numeric(20,10) ,
num_of_shares integer ,
num_of_trades integer ,
trd_id bigint NOT NULL ,
ins_ts timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL
)

WITH (
appendoptimized=true
,orientation=row
,compresstype=zlib
,compresslevel=5
)
DISTRIBUTED RANDOMLY
PARTITION BY RANGE (trd_date_key) (
START ('2020-01-01'::date) INCLUSIVE
END ('2027-01-01'::date) EXCLUSIVE
EVERY (interval '1 Year')
)
;

alter table star.trd_fct add partition start ('2027-01-01') inclusive end ('2028-01-01') exclusive;

Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.

Contributor's Checklist

Here are some reminders and checklists before/when submitting your pull request, please check them:

  • Make sure your Pull Request has a clear title and commit message. You can take git-commit template as a reference.
  • Sign the Contributor License Agreement as prompted for your first-time contribution(One-time setup).
  • Learn the coding contribution guide, including our code conventions, workflow and more.
  • List your communication in the GitHub Issues or Discussions (if has or needed).
  • Document changes.
  • Add tests for the change
  • Pass make installcheck
  • Pass make -C src/test installcheck-cbdb-parallel
  • Feel free to request cloudberrydb/dev team for review and approval when your PR is ready🥳

@my-ship-it
Copy link
Contributor

Please add some test cases, thanks

@my-ship-it my-ship-it self-requested a review November 1, 2024 06:28
@reshke
Copy link
Contributor

reshke commented Nov 1, 2024

Hi, I have failure with this change

db2=# \d+ star.trd_fct
row number 0 is out of range 0..-1
row number 0 is out of range 0..-1
cannot duplicate null pointer (internal error)

@reshke
Copy link
Contributor

reshke commented Nov 1, 2024

Hi, I have failure with this change

db2=# \d+ star.trd_fct
row number 0 is out of range 0..-1
row number 0 is out of range 0..-1
cannot duplicate null pointer (internal error)

Oh, sorry, looks like this is not related to current pr. I will take a look. Issue persist on master

@reshke
Copy link
Contributor

reshke commented Nov 1, 2024

Hi, I have failure with this change

db2=# \d+ star.trd_fct
row number 0 is out of range 0..-1
row number 0 is out of range 0..-1
cannot duplicate null pointer (internal error)

#697

@reshke
Copy link
Contributor

reshke commented Nov 1, 2024

I found another issue #698. we can fix this within this pr, or i can created separate pr for this.

@gfphoenix78
Copy link
Contributor Author

Please add some test cases, thanks

Sure, the PR isn't fully ready yet. I'll some the full test when inherited encoding attributes are supported.

Copy link
Contributor

@reshke reshke left a comment

Choose a reason for hiding this comment

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

Ok, now lets run the tests.

@gfphoenix78 gfphoenix78 marked this pull request as ready for review November 5, 2024 00:33
@tuhaihe
Copy link
Member

tuhaihe commented Nov 11, 2024

Hi @reshke Do you link your GitHub account with your Apache ID? It seems that your approval does not have binding access. Welcome to visit https://gitbox.apache.org/boxer/ to double-check.

@gfphoenix78 gfphoenix78 force-pushed the gp-part-compat branch 2 times, most recently from d9259f3 to bdc7f6c Compare November 21, 2024 08:07
Currently, the child partition doesn't inherit the table access
method, column encoding and reloptions from its parent table
when the child table is added later. The change causes
in-compatible behavior for users from gpdb.

To achieve the target, the kernel saves table access method in
pg_class for gp-style partition table, to be inherited by the
child table.
Reloption and column encoding of the child partitions also inherits
from its parent if they are absent.

However, the bahaviors between greenplum and cloudberry are still
not 100% compatible.
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.

5 participants