Skip to content

Commit

Permalink
chore(cubestore): Upgrade DF: Revert lowercasing in InlineTable::New,…
Browse files Browse the repository at this point in the history
… fix tests

Fixes case-insensitive comparisons in planning tests and lowercases
appropriately in inline_tables[_2x] tests.
  • Loading branch information
srh committed Dec 12, 2024
1 parent dc65247 commit ddec665
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions rust/cubestore/cubestore-sql-tests/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6708,10 +6708,10 @@ async fn inline_tables(service: Box<dyn SqlClient>) {
);

let columns = vec![
Column::new("ID".to_string(), ColumnType::Int, 0),
Column::new("LastName".to_string(), ColumnType::String, 1),
Column::new("FirstName".to_string(), ColumnType::String, 2),
Column::new("Timestamp".to_string(), ColumnType::Timestamp, 3),
Column::new("id".to_string(), ColumnType::Int, 0),
Column::new("lastname".to_string(), ColumnType::String, 1),
Column::new("firstname".to_string(), ColumnType::String, 2),
Column::new("timestamp".to_string(), ColumnType::Timestamp, 3),
];
let rows = vec![
Row::new(vec![
Expand Down Expand Up @@ -6740,7 +6740,7 @@ async fn inline_tables(service: Box<dyn SqlClient>) {
]),
];
let data = Arc::new(DataFrame::new(columns, rows.clone()));
let inline_tables = vec![InlineTable::new(1000, "Persons".to_string(), data)];
let inline_tables = vec![InlineTable::new(1000, "persons".to_string(), data)];

let context = SqlQueryContext::default().with_inline_tables(&inline_tables);
let result = service
Expand Down Expand Up @@ -6849,9 +6849,9 @@ async fn inline_tables_2x(service: Box<dyn SqlClient>) {
.unwrap();

let columns = vec![
Column::new("ID".to_string(), ColumnType::Int, 0),
Column::new("Last".to_string(), ColumnType::String, 1),
Column::new("First".to_string(), ColumnType::String, 2),
Column::new("id".to_string(), ColumnType::Int, 0),
Column::new("last".to_string(), ColumnType::String, 1),
Column::new("first".to_string(), ColumnType::String, 2),
];
let rows = vec![
Row::new(vec![
Expand Down Expand Up @@ -6890,8 +6890,8 @@ async fn inline_tables_2x(service: Box<dyn SqlClient>) {
let data = Arc::new(DataFrame::new(columns.clone(), rows.clone()));
let data2 = Arc::new(DataFrame::new(columns.clone(), rows2.clone()));
let inline_tables = vec![
InlineTable::new(1000, "Persons".to_string(), data),
InlineTable::new(1001, "Persons2".to_string(), data2),
InlineTable::new(1000, "persons".to_string(), data),
InlineTable::new(1001, "persons2".to_string(), data2),
];

let context = SqlQueryContext::default().with_inline_tables(&inline_tables);
Expand Down
8 changes: 4 additions & 4 deletions rust/cubestore/cubestore/src/queryplanner/planning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2238,7 +2238,7 @@ pub mod tests {
"customer_registered_date",
]);
let customers = i.add_table(Table::new(
"Customers".to_string(),
"customers".to_string(),
SCHEMA,
customers_cols.clone(),
None,
Expand Down Expand Up @@ -2290,7 +2290,7 @@ pub mod tests {
"order_city",
]);
let orders = i.add_table(Table::new(
"Orders".to_string(),
"orders".to_string(),
SCHEMA,
orders_cols.clone(),
None,
Expand Down Expand Up @@ -2348,7 +2348,7 @@ pub mod tests {
}

i.add_table(Table::new(
"Products".to_string(),
"products".to_string(),
SCHEMA,
int_columns(&["product_id", "product_name"]),
None,
Expand Down Expand Up @@ -2467,7 +2467,7 @@ pub mod tests {
};
self.tables
.iter()
.find_position(|t| t.get_table_name().to_lowercase() == name.to_lowercase())
.find_position(|t| t.get_table_name() == name.as_ref())
.map(|(id, t)| -> Arc<dyn TableSource> {
let schema = Arc::new(ArrowSchema::new(
t.get_columns()
Expand Down
2 changes: 1 addition & 1 deletion rust/cubestore/cubestore/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub type InlineTables = Vec<InlineTable>;

impl InlineTable {
pub fn new(id: u64, name: String, data: Arc<DataFrame>) -> Self {
Self { id, name: name.to_lowercase(), data: Arc::new(data.lowercase()) }
Self { id, name, data }
}
}

Expand Down

0 comments on commit ddec665

Please sign in to comment.