Skip to content

Commit 0376d0e

Browse files
authored
Revert "Perf/tpcc order status (#301)"
This reverts commit 57a1a06.
1 parent 57a1a06 commit 0376d0e

61 files changed

Lines changed: 852 additions & 1983 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,15 @@ run `cargo run -p tpcc --release` to run tpcc
8888
- 32.0 GB
8989
- KIOXIA-EXCERIA PLUS G3 SSD
9090
- Tips: TPC-C currently only supports single thread
91-
92-
All cases have been fully optimized.
9391
```shell
9492
<90th Percentile RT (MaxRT)>
95-
New-Order : 0.002 (0.012)
96-
Payment : 0.001 (0.002)
97-
Order-Status : 0.002 (0.019)
93+
New-Order : 0.002 (0.005)
94+
Payment : 0.001 (0.003)
95+
Order-Status : 0.057 (0.088)
9896
Delivery : 0.001 (0.001)
99-
Stock-Level : 0.002 (0.018)
97+
Stock-Level : 0.002 (0.006)
10098
<TpmC>
101-
37166 Tpmc
99+
11125 Tpmc
102100
```
103101
#### 👉[check more](tpcc/README.md)
104102

src/binder/aggregate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
9898
return_orderby.push(SortField::new(
9999
expr,
100100
asc.is_none_or(|asc| asc),
101-
nulls_first.unwrap_or(true),
101+
nulls_first.is_some_and(|first| first),
102102
));
103103
}
104104
Some(return_orderby)

src/binder/alter_table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
4444
if_not_exists,
4545
column_def,
4646
} => {
47-
let plan = TableScanOperator::build(table_name.clone(), table, true)?;
47+
let plan = TableScanOperator::build(table_name.clone(), table, true);
4848
let column = self.bind_column(column_def, None)?;
4949

5050
if !is_valid_identifier(column.name()) {
@@ -66,7 +66,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
6666
if_exists,
6767
..
6868
} => {
69-
let plan = TableScanOperator::build(table_name.clone(), table, true)?;
69+
let plan = TableScanOperator::build(table_name.clone(), table, true);
7070
let column_name = column_name.value.clone();
7171

7272
LogicalPlan::new(

src/binder/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
4040
.ok_or(DatabaseError::TableNotFound)?;
4141
let index_metas = table.indexes.clone();
4242

43-
let scan_op = TableScanOperator::build(table_name.clone(), table, false)?;
43+
let scan_op = TableScanOperator::build(table_name.clone(), table, false);
4444
Ok(LogicalPlan::new(
4545
Operator::Analyze(AnalyzeOperator {
4646
table_name,

src/binder/copy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
118118
target: ext_source,
119119
schema_ref,
120120
}),
121-
Childrens::Only(Box::new(TableScanOperator::build(
122-
table_name, table, false,
123-
)?)),
121+
Childrens::Only(Box::new(TableScanOperator::build(table_name, table, false))),
124122
))
125123
} else {
126124
// COPY <dest_table> FROM <source_file>

src/binder/create_index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
4949
.source_and_bind(table_name.clone(), None, None, false)?
5050
.ok_or(DatabaseError::SourceNotFound)?;
5151
let plan = match source {
52-
Source::Table(table) => TableScanOperator::build(table_name.clone(), table, true)?,
52+
Source::Table(table) => TableScanOperator::build(table_name.clone(), table, true),
5353
Source::View(view) => LogicalPlan::clone(&view.plan),
5454
};
5555
let mut columns = Vec::with_capacity(exprs.len());

src/binder/delete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
5151
.iter()
5252
.map(|(_, column)| column.clone())
5353
.collect_vec();
54-
let mut plan = TableScanOperator::build(table_name.clone(), table, true)?;
54+
let mut plan = TableScanOperator::build(table_name.clone(), table, true);
5555

5656
if let Some(alias_idents) = alias_idents {
5757
plan =

src/binder/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
541541
.source_and_bind(table_name.clone(), table_alias.as_ref(), join_type, false)?
542542
.ok_or(DatabaseError::SourceNotFound)?;
543543
let mut plan = match source {
544-
Source::Table(table) => TableScanOperator::build(table_name.clone(), table, with_pk)?,
544+
Source::Table(table) => TableScanOperator::build(table_name.clone(), table, with_pk),
545545
Source::View(view) => LogicalPlan::clone(&view.plan),
546546
};
547547

src/catalog/table.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub struct TableCatalog {
3838
schema_ref: SchemaRef,
3939
primary_keys: Vec<(usize, ColumnRef)>,
4040
primary_key_indices: PrimaryKeyIndices,
41-
primary_key_type: LogicalType,
41+
primary_key_type: Option<LogicalType>,
4242
}
4343

4444
//TODO: can add some like Table description and other information as attributes
@@ -99,10 +99,6 @@ impl TableCatalog {
9999
&self.primary_keys
100100
}
101101

102-
pub(crate) fn primary_keys_type(&self) -> &LogicalType {
103-
&self.primary_key_type
104-
}
105-
106102
pub(crate) fn primary_keys_indices(&self) -> &PrimaryKeyIndices {
107103
&self.primary_key_indices
108104
}
@@ -148,7 +144,23 @@ impl TableCatalog {
148144
}
149145

150146
let index_id = self.indexes.last().map(|index| index.id + 1).unwrap_or(0);
151-
let pk_ty = self.primary_key_type.clone();
147+
let pk_ty = self
148+
.primary_key_type
149+
.get_or_insert_with(|| {
150+
let primary_keys = &self.primary_keys;
151+
152+
if primary_keys.len() == 1 {
153+
primary_keys[0].1.datatype().clone()
154+
} else {
155+
LogicalType::Tuple(
156+
primary_keys
157+
.iter()
158+
.map(|(_, column)| column.datatype().clone())
159+
.collect_vec(),
160+
)
161+
}
162+
})
163+
.clone();
152164

153165
let mut val_tys = Vec::with_capacity(column_ids.len());
154166
for column_id in column_ids.iter() {
@@ -193,7 +205,7 @@ impl TableCatalog {
193205
schema_ref: Arc::new(vec![]),
194206
primary_keys: vec![],
195207
primary_key_indices: Default::default(),
196-
primary_key_type: LogicalType::SqlNull,
208+
primary_key_type: None,
197209
};
198210
let mut generator = Generator::new();
199211
for col_catalog in columns.into_iter() {
@@ -204,26 +216,12 @@ impl TableCatalog {
204216
let (primary_keys, primary_key_indices) =
205217
Self::build_primary_keys(&table_catalog.schema_ref);
206218

207-
table_catalog.primary_key_type = Self::build_primary_key_type(&primary_keys);
208219
table_catalog.primary_keys = primary_keys;
209220
table_catalog.primary_key_indices = primary_key_indices;
210221

211222
Ok(table_catalog)
212223
}
213224

214-
fn build_primary_key_type(primary_keys: &[(usize, ColumnRef)]) -> LogicalType {
215-
if primary_keys.len() == 1 {
216-
primary_keys[0].1.datatype().clone()
217-
} else {
218-
LogicalType::Tuple(
219-
primary_keys
220-
.iter()
221-
.map(|(_, column)| column.datatype().clone())
222-
.collect_vec(),
223-
)
224-
}
225-
}
226-
227225
pub(crate) fn reload(
228226
name: TableName,
229227
column_refs: Vec<ColumnRef>,
@@ -242,7 +240,6 @@ impl TableCatalog {
242240
}
243241
let schema_ref = Arc::new(column_refs.clone());
244242
let (primary_keys, primary_key_indices) = Self::build_primary_keys(&schema_ref);
245-
let primary_key_type = Self::build_primary_key_type(&primary_keys);
246243

247244
Ok(TableCatalog {
248245
name,
@@ -252,7 +249,7 @@ impl TableCatalog {
252249
schema_ref,
253250
primary_keys,
254251
primary_key_indices,
255-
primary_key_type,
252+
primary_key_type: None,
256253
})
257254
}
258255

0 commit comments

Comments
 (0)