1414
1515use std:: any:: Any ;
1616use std:: collections:: BTreeMap ;
17+ use std:: collections:: HashMap ;
1718use std:: sync:: Arc ;
1819
1920use chrono:: DateTime ;
@@ -22,12 +23,13 @@ use databend_common_exception::ErrorCode;
2223use databend_common_exception:: Result ;
2324use databend_common_expression:: BlockThresholds ;
2425use databend_common_expression:: ColumnId ;
25- use databend_common_expression:: RemoteExpr ;
2626use databend_common_expression:: Scalar ;
2727use databend_common_expression:: TableSchema ;
2828use databend_common_io:: constants:: DEFAULT_BLOCK_BUFFER_SIZE ;
2929use databend_common_io:: constants:: DEFAULT_BLOCK_MAX_ROWS ;
3030use databend_common_io:: constants:: DEFAULT_BLOCK_MIN_ROWS ;
31+ use databend_common_meta_app:: app_error:: AppError ;
32+ use databend_common_meta_app:: app_error:: UnknownTableId ;
3133use databend_common_meta_app:: schema:: TableIdent ;
3234use databend_common_meta_app:: schema:: TableInfo ;
3335use databend_common_meta_app:: schema:: TableMeta ;
@@ -37,9 +39,12 @@ use databend_common_meta_types::MetaId;
3739use databend_common_pipeline_core:: Pipeline ;
3840use databend_common_storage:: Histogram ;
3941use databend_common_storage:: StorageMetrics ;
42+ use databend_storages_common_table_meta:: meta:: ClusterKey ;
4043use databend_storages_common_table_meta:: meta:: SnapshotId ;
4144use databend_storages_common_table_meta:: meta:: TableSnapshot ;
4245use databend_storages_common_table_meta:: table:: ChangeType ;
46+ use databend_storages_common_table_meta:: table:: ClusterType ;
47+ use databend_storages_common_table_meta:: table:: OPT_KEY_CLUSTER_TYPE ;
4348use databend_storages_common_table_meta:: table:: OPT_KEY_TEMP_PREFIX ;
4449use databend_storages_common_table_meta:: table_id_ranges:: is_temp_table_id;
4550
@@ -117,8 +122,18 @@ pub trait Table: Sync + Send {
117122 false
118123 }
119124
120- fn cluster_keys ( & self , _ctx : Arc < dyn TableContext > ) -> Vec < RemoteExpr < String > > {
121- vec ! [ ]
125+ fn cluster_key_meta ( & self ) -> Option < ClusterKey > {
126+ None
127+ }
128+
129+ fn cluster_type ( & self ) -> Option < ClusterType > {
130+ self . cluster_key_meta ( ) ?;
131+ let cluster_type = self
132+ . options ( )
133+ . get ( OPT_KEY_CLUSTER_TYPE )
134+ . and_then ( |s| s. parse :: < ClusterType > ( ) . ok ( ) )
135+ . unwrap_or ( ClusterType :: Linear ) ;
136+ Some ( cluster_type)
122137 }
123138
124139 fn change_tracking_enabled ( & self ) -> bool {
@@ -159,31 +174,6 @@ pub trait Table: Sync + Send {
159174 false
160175 }
161176
162- #[ async_backtrace:: framed]
163- async fn alter_table_cluster_keys (
164- & self ,
165- ctx : Arc < dyn TableContext > ,
166- cluster_key : String ,
167- cluster_type : String ,
168- ) -> Result < ( ) > {
169- let ( _, _, _) = ( ctx, cluster_key, cluster_type) ;
170-
171- Err ( ErrorCode :: UnsupportedEngineParams ( format ! (
172- "Altering table cluster keys is not supported for the '{}' engine." ,
173- self . engine( )
174- ) ) )
175- }
176-
177- #[ async_backtrace:: framed]
178- async fn drop_table_cluster_keys ( & self , ctx : Arc < dyn TableContext > ) -> Result < ( ) > {
179- let _ = ctx;
180-
181- Err ( ErrorCode :: UnsupportedEngineParams ( format ! (
182- "Dropping table cluster keys is not supported for the '{}' engine." ,
183- self . engine( )
184- ) ) )
185- }
186-
187177 /// Gather partitions to be scanned according to the push_downs
188178 #[ async_backtrace:: framed]
189179 async fn read_partitions (
@@ -584,11 +574,6 @@ pub struct NavigationDescriptor {
584574 pub point : NavigationPoint ,
585575}
586576
587- use std:: collections:: HashMap ;
588-
589- use databend_common_meta_app:: app_error:: AppError ;
590- use databend_common_meta_app:: app_error:: UnknownTableId ;
591-
592577#[ derive( serde:: Serialize , serde:: Deserialize , Clone , Debug , Default ) ]
593578pub struct ParquetTableColumnStatisticsProvider {
594579 column_stats : HashMap < ColumnId , Option < BasicColumnStatistics > > ,
0 commit comments