Skip to content

Commit

Permalink
fix the warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
codingkarthik committed Nov 6, 2024
1 parent eba311a commit 7c76643
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 38 deletions.
1 change: 0 additions & 1 deletion crates/calcite-schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ pub mod jvm;

pub mod configuration;
pub mod version;
mod metrics;
mod test;
mod list_files;
13 changes: 0 additions & 13 deletions crates/calcite-schema/src/metrics.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/calcite-schema/src/version5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::{HashMap};
use std::{error, fmt};
use std::path::Path;
use jni::errors::{Error, JniError};
use jni::JNIEnv;
use jni::objects::{GlobalRef, JObject, JValueGen, JValueOwned};
use jni::objects::JValueGen::Object;
Expand Down
8 changes: 4 additions & 4 deletions crates/connectors/ndc-calcite/src/calcite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ fn fix_rows(rows: Vec<Row>, query_metadata: &models::Query) -> Vec<Row> {
}
}
for (_key, value) in &mut row {
if let RowFieldValue(val) = value {
if val == "null" {
*value = RowFieldValue(Value::Null);
}
let RowFieldValue(val) = value;
if val == "null" {
*value = RowFieldValue(Value::Null);
}

}
row.swap_remove("CONSTANT");
row
Expand Down
37 changes: 18 additions & 19 deletions crates/connectors/ndc-calcite/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,25 +265,24 @@ fn process_object_relationship(rows: Vec<Row>, field_name: &FieldName, fk_rows:
let rowset = serde_json::map::Map::new();
if let Some(value) = row.get_mut(field_name) {
event!(Level::DEBUG, "value: {:?}", value);
if let RowFieldValue(_) = *value {
let (key, name) = pks[0].clone();
event!(Level::DEBUG, "key: {:?}, name: {:?}", key, name);
let mut child_rows = Vec::new();
for x in fk_rows {
if let Some(value) = x.get(&key) {
event!(Level::DEBUG, "value: {:?}", value);
if value.0 == pk_value {
child_rows.push(x);
}
} else {
event!(Level::DEBUG, "value: {:?}", value);
let (key, name) = pks[0].clone();
event!(Level::DEBUG, "key: {:?}, name: {:?}", key, name);
let mut child_rows = Vec::new();
for x in fk_rows {
if let Some(value) = x.get(&key) {
event!(Level::DEBUG, "value: {:?}", value);
if value.0 == pk_value {
child_rows.push(x);
}
} else {
event!(Level::DEBUG, "value: {:?}", value);
}
if child_rows.len() > 1 {
child_rows = vec![child_rows[0]];
}
process_child_rows(&child_rows, rowset, value).expect("TODO: panic message");
}
if child_rows.len() > 1 {
child_rows = vec![child_rows[0]];
}
process_child_rows(&child_rows, rowset, value).expect("TODO: panic message");

}
row
}).collect();
Expand All @@ -300,7 +299,7 @@ fn process_array_relationship(rows: Option<Vec<Row>>, field_name: &FieldName, fk
let pk_value = row.get(fks[0]).unwrap().0.clone();
if let Some(value) = row.get_mut(field_name) {
event!(Level::DEBUG, "value: {:?}", value);
if let RowFieldValue(_) = *value {

let (key, name) = pks[0].clone();
event!(Level::DEBUG, "key: {:?}, name: {:?}", key, name);
let mut child_rows = Vec::new();
Expand All @@ -317,7 +316,7 @@ fn process_array_relationship(rows: Option<Vec<Row>>, field_name: &FieldName, fk
}
event!(Level::DEBUG, "Key: {:?}, Name: {:?}, Child Rows: {:?}", key, name, child_rows);
process_child_rows(&child_rows, rowset, value).expect("TODO: panic message");
}

}
row
}).collect();
Expand Down Expand Up @@ -394,4 +393,4 @@ fn execute_query_collection(
Ok(v) => Ok(Some(v)),
Err(e) => Err(e)
}
}
}

0 comments on commit 7c76643

Please sign in to comment.