use leaf_index get tuple phy_column_id
@@ -304,7 +304,6 @@ impl<'a> Binder {
let columns = self.metadata.read().columns_by_table_index(table_index);
let table = self.metadata.read().table(table_index).clone();
- let mut has_path_indices = false;
let mut col_stats: HashMap<IndexType, Option<ColumnStatistics>> = HashMap::new();
for column in columns.iter() {
let column_binding = ColumnBinding {
@@ -320,20 +319,19 @@ impl<'a> Binder {
},
};
bind_context.add_column_binding(column_binding);
- if !has_path_indices {
- // create table t (c0 tuple(int, int), c1 string null) in planner col index is : (0: c0, 1: c1, 2: c0:2 3: c0:2)
- // in storage column (0: PrimitiveColumn, 1: PrimitiveColumn, 2: NullableColumn)
- has_path_indices = column.has_path_indices();
- }
+ if !column.has_path_indices() {
+ if let Some(col_id) = column.leaf_index() {
let col_stat = table
.table()
.column_statistics_provider()
.await?
- .column_statistics(column.index() as ColumnId);
+ .column_statistics(col_id as ColumnId);
col_stats.insert(column.index(), col_stat);
}
+ }
+ }
- let is_accurate = !has_path_indices && table.table().engine().to_lowercase() == "fuse";
+ let is_accurate = table.table().engine().to_lowercase() == "fuse";
let stat = table.table().table_statistics()?;
Ok((
SExpr::create_leaf(
