apache / cloudberry

Cloudberry Database - Open source alternative to Greenplum Database. Created by the original Greenplum developers.
https://cloudberrydb.org/
Apache License 2.0
403 stars 100 forks source link

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

Closed congxuebin closed 4 months ago

congxuebin commented 10 months ago

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?

Code of Conduct

congxuebin commented 10 months ago

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 commented 4 months ago

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

congxuebin commented 4 months ago

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 commented 4 months ago
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.