refactor: address review comments

pull/24376/head
Nga Tran 2021-09-21 14:46:24 -04:00
parent 61ed67a5d9
commit 2f371b6f79
4 changed files with 1293 additions and 1275 deletions

View File

@ -188,7 +188,7 @@ impl Predicate {
} }
/// Merge the given delete predicates into this select predicate. /// Merge the given delete predicates into this select predicate.
/// Since we wan to eliminate data filtered by the delete predicates, /// Since we want to eliminate data filtered by the delete predicates,
/// they are first converted into their negated form: NOT(delete_predicate) /// they are first converted into their negated form: NOT(delete_predicate)
/// then added/merged into the selection one /// then added/merged into the selection one
pub fn merge_delete_predicates<S>(&mut self, delete_predicates: &[S]) pub fn merge_delete_predicates<S>(&mut self, delete_predicates: &[S])
@ -197,7 +197,7 @@ impl Predicate {
{ {
// Create a list of disjunctive negated expressions. // Create a list of disjunctive negated expressions.
// Example: there are two deletes as follows (note that time_range is stored separated in the Predicate // Example: there are two deletes as follows (note that time_range is stored separated in the Predicate
// but we need to put it together with the exprs hee) // but we need to put it together with the exprs here)
// . Delete_1: WHERE city != "Boston" AND temp = 70 AND time_range in [10, 30) // . Delete_1: WHERE city != "Boston" AND temp = 70 AND time_range in [10, 30)
// . Delete 2: WHERE state = "NY" AND route != "I90" AND time_range in [20, 50) // . Delete 2: WHERE state = "NY" AND route != "I90" AND time_range in [20, 50)
// The negated list will be "NOT(Delete_1)", NOT(Delete_2)" which means // The negated list will be "NOT(Delete_1)", NOT(Delete_2)" which means

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,8 @@
//! wired all the pieces together (as well as ensure any particularly //! wired all the pieces together (as well as ensure any particularly
//! important SQL does not regress) //! important SQL does not regress)
use crate::scenarios;
use super::scenarios::*; use super::scenarios::*;
use arrow::record_batch::RecordBatch; use arrow::record_batch::RecordBatch;
use arrow_util::assert_batches_sorted_eq; use arrow_util::assert_batches_sorted_eq;
@ -823,21 +825,21 @@ async fn sql_select_with_deleted_data_from_one_expr() {
// Data deleted when it is in MUB, and then moved to RUB and OS // Data deleted when it is in MUB, and then moved to RUB and OS
run_sql_test_case!( run_sql_test_case!(
DeleteFromMubOneMeasurementOneChunk {}, scenarios::delete::DeleteFromMubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in RUB, and then moved OS // Data deleted when it is in RUB, and then moved OS
run_sql_test_case!( run_sql_test_case!(
DeleteFromRubOneMeasurementOneChunk {}, scenarios::delete::DeleteFromRubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in OS // Data deleted when it is in OS
run_sql_test_case!( run_sql_test_case!(
DeleteFromOsOneMeasurementOneChunk {}, scenarios::delete::DeleteFromOsOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
@ -856,21 +858,21 @@ async fn sql_select_with_deleted_data_from_multi_exprs() {
// Data deleted when it is in MUB, and then moved to RUB and OS // Data deleted when it is in MUB, and then moved to RUB and OS
run_sql_test_case!( run_sql_test_case!(
DeleteMultiExprsFromMubOneMeasurementOneChunk {}, scenarios::delete::DeleteMultiExprsFromMubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in RUB, and then moved OS // Data deleted when it is in RUB, and then moved OS
run_sql_test_case!( run_sql_test_case!(
DeleteMultiExprsFromRubOneMeasurementOneChunk {}, scenarios::delete::DeleteMultiExprsFromRubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in OS // Data deleted when it is in OS
run_sql_test_case!( run_sql_test_case!(
DeleteMultiExprsFromOsOneMeasurementOneChunk {}, scenarios::delete::DeleteMultiExprsFromOsOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
@ -888,21 +890,21 @@ async fn sql_select_with_two_deleted_data_from_multi_exprs() {
// Data deleted when it is in MUB, and then moved to RUB and OS // Data deleted when it is in MUB, and then moved to RUB and OS
run_sql_test_case!( run_sql_test_case!(
TwoDeleteMultiExprsFromMubOneMeasurementOneChunk {}, scenarios::delete::TwoDeleteMultiExprsFromMubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in RUB, and then moved OS // Data deleted when it is in RUB, and then moved OS
run_sql_test_case!( run_sql_test_case!(
TwoDeleteMultiExprsFromRubOneMeasurementOneChunk {}, scenarios::delete::TwoDeleteMultiExprsFromRubOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );
// Data deleted when it is in OS // Data deleted when it is in OS
run_sql_test_case!( run_sql_test_case!(
TwoDeleteMultiExprsFromOsOneMeasurementOneChunk {}, scenarios::delete::TwoDeleteMultiExprsFromOsOneMeasurementOneChunk {},
"SELECT * from cpu", "SELECT * from cpu",
&expected &expected
); );