File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed
sql/src/planner/binder/ddl
storages/common/table_meta/src/table
tests/sqllogictests/suites/base/05_ddl Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ use databend_common_storage::init_operator;
88
88
use databend_common_storages_view:: view_table:: QUERY ;
89
89
use databend_common_storages_view:: view_table:: VIEW_ENGINE ;
90
90
use databend_storages_common_table_meta:: table:: is_reserved_opt_key;
91
+ use databend_storages_common_table_meta:: table:: TableCompression ;
91
92
use databend_storages_common_table_meta:: table:: OPT_KEY_CLUSTER_TYPE ;
92
93
use databend_storages_common_table_meta:: table:: OPT_KEY_DATABASE_ID ;
93
94
use databend_storages_common_table_meta:: table:: OPT_KEY_ENGINE_META ;
@@ -742,6 +743,15 @@ impl Binder {
742
743
OPT_KEY_TABLE_COMPRESSION . to_owned ( ) ,
743
744
default_compression. to_owned ( ) ,
744
745
) ;
746
+ } else {
747
+ // validate the compression type
748
+ let _: TableCompression = options
749
+ . get ( OPT_KEY_TABLE_COMPRESSION )
750
+ . ok_or_else ( || {
751
+ ErrorCode :: BadArguments ( "Table compression type is not specified" )
752
+ } ) ?
753
+ . as_str ( )
754
+ . try_into ( ) ?;
745
755
}
746
756
} else if table_indexes. is_some ( ) {
747
757
return Err ( ErrorCode :: UnsupportedIndex ( format ! (
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl TryFrom<&str> for TableCompression {
40
40
"zstd" => Ok ( TableCompression :: Zstd ) ,
41
41
"lz4" => Ok ( TableCompression :: LZ4 ) ,
42
42
"snappy" => Ok ( TableCompression :: Snappy ) ,
43
- other => Err ( ErrorCode :: UnknownFormat ( format ! (
43
+ other => Err ( ErrorCode :: UnknownCompressionType ( format ! (
44
44
"unsupported table compression: {}" ,
45
45
other
46
46
) ) ) ,
Original file line number Diff line number Diff line change @@ -681,3 +681,6 @@ query
681
681
select '\'0\'' = a from t
682
682
----
683
683
1
684
+
685
+ statement error 1075
686
+ create or replace table t(id int) compression='xxxx';
You canโt perform that action at this time.
0 commit comments