14
14
15
15
use std:: any:: Any ;
16
16
use std:: collections:: BTreeMap ;
17
+ use std:: collections:: HashMap ;
17
18
use std:: sync:: Arc ;
18
19
19
20
use chrono:: DateTime ;
@@ -22,12 +23,13 @@ use databend_common_exception::ErrorCode;
22
23
use databend_common_exception:: Result ;
23
24
use databend_common_expression:: BlockThresholds ;
24
25
use databend_common_expression:: ColumnId ;
25
- use databend_common_expression:: RemoteExpr ;
26
26
use databend_common_expression:: Scalar ;
27
27
use databend_common_expression:: TableSchema ;
28
28
use databend_common_io:: constants:: DEFAULT_BLOCK_BUFFER_SIZE ;
29
29
use databend_common_io:: constants:: DEFAULT_BLOCK_MAX_ROWS ;
30
30
use 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 ;
31
33
use databend_common_meta_app:: schema:: TableIdent ;
32
34
use databend_common_meta_app:: schema:: TableInfo ;
33
35
use databend_common_meta_app:: schema:: TableMeta ;
@@ -37,9 +39,12 @@ use databend_common_meta_types::MetaId;
37
39
use databend_common_pipeline_core:: Pipeline ;
38
40
use databend_common_storage:: Histogram ;
39
41
use databend_common_storage:: StorageMetrics ;
42
+ use databend_storages_common_table_meta:: meta:: ClusterKey ;
40
43
use databend_storages_common_table_meta:: meta:: SnapshotId ;
41
44
use databend_storages_common_table_meta:: meta:: TableSnapshot ;
42
45
use 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 ;
43
48
use databend_storages_common_table_meta:: table:: OPT_KEY_TEMP_PREFIX ;
44
49
use databend_storages_common_table_meta:: table_id_ranges:: is_temp_table_id;
45
50
@@ -117,8 +122,18 @@ pub trait Table: Sync + Send {
117
122
false
118
123
}
119
124
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)
122
137
}
123
138
124
139
fn change_tracking_enabled ( & self ) -> bool {
@@ -159,31 +174,6 @@ pub trait Table: Sync + Send {
159
174
false
160
175
}
161
176
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
-
187
177
/// Gather partitions to be scanned according to the push_downs
188
178
#[ async_backtrace:: framed]
189
179
async fn read_partitions (
@@ -584,11 +574,6 @@ pub struct NavigationDescriptor {
584
574
pub point : NavigationPoint ,
585
575
}
586
576
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
-
592
577
#[ derive( serde:: Serialize , serde:: Deserialize , Clone , Debug , Default ) ]
593
578
pub struct ParquetTableColumnStatisticsProvider {
594
579
column_stats : HashMap < ColumnId , Option < BasicColumnStatistics > > ,
0 commit comments