cloudberry icon indicating copy to clipboard operation
cloudberry copied to clipboard

[Bug] a table specified with "appendonly=true, orientation=column" appears not as an ao table

Open congxuebin opened this issue 1 year ago • 1 comments

Cloudberry Database version

Expected:

create table mpp17761.split_tab5( a int, b int, c char(5), d boolean default true) with (appendonly=true, orientation=column ) 
distributed randomly 
partition by list(b)
(
    partition a values (1,2,3,4) with (appendonly = true), 
    partition b values(5,6,7,8) with (appendonly = true),
    DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=5)
);
CREATE TABLE

Actual behavior:

create table mpp17761.split_tab5( a int, b int, c char(5), d boolean default true) with (appendonly=true, orientation=column ) 
distributed randomly 
partition by list(b)
(
    partition a values (1,2,3,4) with (appendonly = true), 
    partition b values(5,6,7,8) with (appendonly = true),
    DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=5)
);
);
psql:/code/cbdb_testrepo_src/mpp/gpdb/tests/storage/basic/partition/output/mpp17761.sql:196: ERROR:  ENCODING clause only supported with column oriented tables

What happened

As stated above,

What you think should happen instead

No response

How to reproduce

As stated above

Operating System

centos7

Anything else

No response

Are you willing to submit PR?

  • [ ] Yes, I am willing to submit a PR!

Code of Conduct

congxuebin avatar Jan 19 '24 04:01 congxuebin

I tried on old version cbdb, it is not as AO table(I don't see Access method ao_column), which could be the problem?

gpadmin=# create table split_tab5( a int, b int, c char(5), d boolean default true) with (appendonly=true, orientation=column ) 
distributed randomly 
partition by list(b)
(
    partition a values (1,2,3,4) with (appendonly = true), 
    partition b values(5,6,7,8) with (appendonly = true),
    DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=5)
);
CREATE TABLE
gpadmin=# \d+ split_tab5
                                    Partitioned table "public.split_tab5"
 Column |     Type     | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+-------------+--------------+-------------
 a      | integer      |           |          |         | plain    |             |              | 
 b      | integer      |           |          |         | plain    |             |              | 
 c      | character(5) |           |          |         | extended |             |              | 
 d      | boolean      |           |          | true    | plain    |             |              | 
Partition key: LIST (b)
Partitions: split_tab5_1_prt_a FOR VALUES IN (1, 2, 3, 4),
            split_tab5_1_prt_b FOR VALUES IN (5, 6, 7, 8)
Distributed randomly

congxuebin avatar Jan 19 '24 04:01 congxuebin

Hi @gfphoenix78,
This is a backlog issue reminder. Please rectify it at your earliest convenience. Thanks.

congxuebin avatar Jun 26 '24 03:06 congxuebin

I tried on old version cbdb, it is not as AO table(I don't see Access method ao_column), which could be the problem?

gpadmin=# create table split_tab5( a int, b int, c char(5), d boolean default true) with (appendonly=true, orientation=column ) 
distributed randomly 
partition by list(b)
(
    partition a values (1,2,3,4) with (appendonly = true), 
    partition b values(5,6,7,8) with (appendonly = true),
    DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=5)
);
CREATE TABLE
gpadmin=# \d+ split_tab5
                                    Partitioned table "public.split_tab5"
 Column |     Type     | Collation | Nullable | Default | Storage  | Compression | Stats target | Description 
--------+--------------+-----------+----------+---------+----------+-------------+--------------+-------------
 a      | integer      |           |          |         | plain    |             |              | 
 b      | integer      |           |          |         | plain    |             |              | 
 c      | character(5) |           |          |         | extended |             |              | 
 d      | boolean      |           |          | true    | plain    |             |              | 
Partition key: LIST (b)
Partitions: split_tab5_1_prt_a FOR VALUES IN (1, 2, 3, 4),
            split_tab5_1_prt_b FOR VALUES IN (5, 6, 7, 8)
Distributed randomly

According to mingli's comment, starting from PostgreSQL 14, the parent partitioned tables no longer support the WITH (storage options) clause. As a result, when you run the \d+ command on a parent table, you won't see the access_method attribute displayed.

congxuebin avatar Jul 03 '24 09:07 congxuebin

create table mpp17761.split_tab5( a int, b int, c char(5), d boolean default true) with (appendonly=true, orientation=column ) 
distributed randomly 
partition by list(b)
(
    partition a values (1,2,3,4) with (appendonly = true), 
    partition b values(5,6,7,8) with (appendonly = true),
    DEFAULT COLUMN ENCODING (compresstype=zlib,compresslevel=5)
);

Confirmed with Hao, in the following CREATE TABLE definition, setting (appendonly = true) in the partition definitions indicates that these partitions will be created as row-oriented tables. Therefore, the error stating that the ENCODING clause is only supported with column-oriented tables is as expected.

Thus I would change test case to resolve this issue. Closing this issue.

congxuebin avatar Jul 03 '24 10:07 congxuebin