From 7c766439e794a7b351efb52c7d80db801798d747 Mon Sep 17 00:00:00 2001 From: Karthikeyan C Date: Wed, 6 Nov 2024 13:31:55 +0530 Subject: [PATCH] fix the warnings --- crates/calcite-schema/src/lib.rs | 1 - crates/calcite-schema/src/metrics.rs | 13 ------- crates/calcite-schema/src/version5.rs | 1 - crates/connectors/ndc-calcite/src/calcite.rs | 8 ++--- crates/connectors/ndc-calcite/src/query.rs | 37 ++++++++++---------- 5 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 crates/calcite-schema/src/metrics.rs diff --git a/crates/calcite-schema/src/lib.rs b/crates/calcite-schema/src/lib.rs index 382834e..5d71904 100644 --- a/crates/calcite-schema/src/lib.rs +++ b/crates/calcite-schema/src/lib.rs @@ -14,6 +14,5 @@ pub mod jvm; pub mod configuration; pub mod version; -mod metrics; mod test; mod list_files; diff --git a/crates/calcite-schema/src/metrics.rs b/crates/calcite-schema/src/metrics.rs deleted file mode 100644 index 7bc99cc..0000000 --- a/crates/calcite-schema/src/metrics.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Metrics setup and update for our connector. - -use prometheus::{IntGauge, Registry}; - -use crate::version::VersionTag; - -/// The collection of configuration-related metrics exposed through the `/metrics` endpoint. -#[derive(Debug, Clone)] -pub struct Metrics { - configuration_version_3: IntGauge, - configuration_version_4: IntGauge, - configuration_version_5: IntGauge, -} diff --git a/crates/calcite-schema/src/version5.rs b/crates/calcite-schema/src/version5.rs index 58676ea..a6634aa 100644 --- a/crates/calcite-schema/src/version5.rs +++ b/crates/calcite-schema/src/version5.rs @@ -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; diff --git a/crates/connectors/ndc-calcite/src/calcite.rs b/crates/connectors/ndc-calcite/src/calcite.rs index 4ba2335..df8d391 100644 --- a/crates/connectors/ndc-calcite/src/calcite.rs +++ b/crates/connectors/ndc-calcite/src/calcite.rs @@ -203,11 +203,11 @@ fn fix_rows(rows: Vec, query_metadata: &models::Query) -> Vec { } } 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 diff --git a/crates/connectors/ndc-calcite/src/query.rs b/crates/connectors/ndc-calcite/src/query.rs index 6949f2d..7da1ad9 100644 --- a/crates/connectors/ndc-calcite/src/query.rs +++ b/crates/connectors/ndc-calcite/src/query.rs @@ -265,25 +265,24 @@ fn process_object_relationship(rows: Vec, 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(); @@ -300,7 +299,7 @@ fn process_array_relationship(rows: Option>, 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(); @@ -317,7 +316,7 @@ fn process_array_relationship(rows: Option>, 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(); @@ -394,4 +393,4 @@ fn execute_query_collection( Ok(v) => Ok(Some(v)), Err(e) => Err(e) } -} \ No newline at end of file +}