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;
8888use databend_common_storages_view:: view_table:: QUERY ;
8989use databend_common_storages_view:: view_table:: VIEW_ENGINE ;
9090use databend_storages_common_table_meta:: table:: is_reserved_opt_key;
91+ use databend_storages_common_table_meta:: table:: TableCompression ;
9192use databend_storages_common_table_meta:: table:: OPT_KEY_CLUSTER_TYPE ;
9293use databend_storages_common_table_meta:: table:: OPT_KEY_DATABASE_ID ;
9394use databend_storages_common_table_meta:: table:: OPT_KEY_ENGINE_META ;
@@ -742,6 +743,15 @@ impl Binder {
742743 OPT_KEY_TABLE_COMPRESSION . to_owned ( ) ,
743744 default_compression. to_owned ( ) ,
744745 ) ;
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 ( ) ?;
745755 }
746756 } else if table_indexes. is_some ( ) {
747757 return Err ( ErrorCode :: UnsupportedIndex ( format ! (
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ impl TryFrom<&str> for TableCompression {
4040 "zstd" => Ok ( TableCompression :: Zstd ) ,
4141 "lz4" => Ok ( TableCompression :: LZ4 ) ,
4242 "snappy" => Ok ( TableCompression :: Snappy ) ,
43- other => Err ( ErrorCode :: UnknownFormat ( format ! (
43+ other => Err ( ErrorCode :: UnknownCompressionType ( format ! (
4444 "unsupported table compression: {}" ,
4545 other
4646 ) ) ) ,
Original file line number Diff line number Diff line change @@ -681,3 +681,6 @@ query
681681select '\'0\'' = a from t
682682----
6836831
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