Skip to content

Conversation

yjhjstz
Copy link
Member

@yjhjstz yjhjstz commented Jun 11, 2025

Previously, when creating a partitioned table without an explicit USING clause, the reloptions (such as minmax_columns) were validated with the assumption that the default_table_access_method is either 'heap', 'ao_row', or 'ao_column'. This could incorrectly reject valid reloptions intended for other table access methods like 'pax'.

This patch adjusts the validation logic in DefineRelation() so that reloptions are only validated for partitioned tables if the default AM is one of the known AMs that support reloptions validation. For non-default AMs, reloptions are passed unvalidated to allow extensions to handle them properly.

This change enables successful creation of partitioned tables using USING pax WITH (minmax_columns=...) without validation errors, even when default_table_access_method is set to 'pax'.

Fixes #1089

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@yjhjstz yjhjstz requested a review from gfphoenix78 June 11, 2025 17:01
@yjhjstz yjhjstz force-pushed the fix_pax_ddl branch 2 times, most recently from 6a01e10 to 3061af5 Compare June 11, 2025 20:03
@avamingli
Copy link
Contributor

when creating a partitioned table without an explicit USING clause, the reloptions (such as minmax_columns) were validated

Do we already have minmax_columns feature in CBDB?

@yjhjstz
Copy link
Member Author

yjhjstz commented Jun 18, 2025

when creating a partitioned table without an explicit USING clause, the reloptions (such as minmax_columns) were validated

Do we already have minmax_columns feature in CBDB?

yes, pax has.

@avamingli
Copy link
Contributor

when creating a partitioned table without an explicit USING clause, the reloptions (such as minmax_columns) were validated

Do we already have minmax_columns feature in CBDB?

yes, pax has.

Can planner use that in CBDB?

@yjhjstz
Copy link
Member Author

yjhjstz commented Jun 18, 2025

yes, orca supported.

@avamingli
Copy link
Contributor

yes, orca supported.

Cases or examples?

@yjhjstz
Copy link
Member Author

yjhjstz commented Jul 4, 2025

yes, orca supported.

Cases or examples?

native support pax storage.

IMDRelation::Erelstoragetype
CTranslatorRelcacheToDXL::RetrieveRelStorageType(Relation rel)
{
	IMDRelation::Erelstoragetype rel_storage_type =
		IMDRelation::ErelstorageSentinel;

	switch (rel->rd_rel->relam)
	{
		case HEAP_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageHeap;
			break;
		case PAX_AM_OID:
			rel_storage_type = IMDRelation::ErelstoragePAX;
			break;
		case AO_COLUMN_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageAppendOnlyCols;
			break;
		case AO_ROW_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageAppendOnlyRows;
			break;
		case 0:

@avamingli
Copy link
Contributor

yes, orca supported.

Cases or examples?

native support pax storage.

IMDRelation::Erelstoragetype
CTranslatorRelcacheToDXL::RetrieveRelStorageType(Relation rel)
{
	IMDRelation::Erelstoragetype rel_storage_type =
		IMDRelation::ErelstorageSentinel;

	switch (rel->rd_rel->relam)
	{
		case HEAP_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageHeap;
			break;
		case PAX_AM_OID:
			rel_storage_type = IMDRelation::ErelstoragePAX;
			break;
		case AO_COLUMN_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageAppendOnlyCols;
			break;
		case AO_ROW_TABLE_AM_OID:
			rel_storage_type = IMDRelation::ErelstorageAppendOnlyRows;
			break;
		case 0:

show a plan ORCA how to use the minmax columns to speed up?

@yjhjstz
Copy link
Member Author

yjhjstz commented Jul 7, 2025

show a plan ORCA how to use the minmax columns to speed up?

please take a look contrib/pax_storage/expected/statistics_bloom_filter.out

…t AMs

Previously, when creating a partitioned table without an explicit
`USING` clause, the reloptions (such as minmax_columns) were validated
with the assumption that the default_table_access_method is either
'heap', 'ao_row', or 'ao_column'. This could incorrectly reject valid
reloptions intended for other table access methods like 'pax'.

This patch adjusts the validation logic in DefineRelation() so that
reloptions are only validated for partitioned tables if the default
AM is one of the known AMs that support reloptions validation. For
non-default AMs, reloptions are passed unvalidated to allow extensions
to handle them properly.

This change enables successful creation of partitioned tables using
`USING pax WITH (minmax_columns=...)` without validation errors, even
when `default_table_access_method` is set to 'pax'.
@yjhjstz yjhjstz requested a review from avamingli July 31, 2025 01:35
@yjhjstz yjhjstz requested a review from jiaqizho August 15, 2025 17:07
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.

[Bug] Pax create table with minmax_columns
3 participants