Skip to content

Commit

Permalink
clean up: removed debug lines and some commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
gneeri committed Nov 24, 2024
1 parent 2eb6a78 commit 67f5e60
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
3 changes: 0 additions & 3 deletions crates/calcite-schema/src/jvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,8 @@ pub fn init_jvm(calcite_configuration: &ParsedConfiguration) {
let state_inited = env::var("STATE_INITED").unwrap_or("false".to_string());
if state_inited == "false" {
let jar_dependency_folder = env::var("JAR_DEPENDENCY_FOLDER");
println!("Jar dependency folder is {:#?}", jar_dependency_folder);
let folder_path = jar_dependency_folder.unwrap_or("/calcite-rs-jni/jni/target/dependency".into());
println!("Folder path is {}", folder_path);
let mut jar_paths = get_jar_files(&folder_path);
println!("Jar paths are {:#?}", jar_paths);
let jar_name = env::var("CALCITE_JAR").unwrap_or("/calcite-rs-jni/jni/target/calcite-rs-jni-1.0-SNAPSHOT.jar".into());

if !jar_name.is_empty() {
Expand Down
30 changes: 0 additions & 30 deletions crates/calcite-schema/src/version5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl CalciteRefSingleton {
pub fn initialize(&self, args: &crate::configuration::ParsedConfiguration) -> Result<(), &'static str> {
match args {
crate::configuration::ParsedConfiguration::Version5(config) => {
println!("&&&&&&&&&&&&&&&&& RACHING HERE");
dotenv::dotenv().ok();
let calcite;
let calcite_ref;
Expand All @@ -68,12 +67,7 @@ impl CalciteRefSingleton {
calcite = create_query_engine(&config, &mut env);
let new_env = java_vm.attach_current_thread_as_daemon().unwrap();
calcite_ref = new_env.new_global_ref(calcite).unwrap();

self.calcite_ref.set(calcite_ref).map_err(| _ | "Calcite Query Engine already initialized").unwrap();
// let java_vm = get_jvm().lock().unwrap();
// let env = java_vm.attach_current_thread_as_daemon().map_err(| _ | "Could not attach thread to JVM") ?;
// let calcite_ref = create_query_engine(&config, env).map_err(|_ | "Could not create Calcite Query Engine") ?;
// self.calcite_ref.set(calcite_ref).map_err(| _ | "Calcite Query Engine already initialized")
Ok(())
}
}
Expand Down Expand Up @@ -127,7 +121,6 @@ pub fn create_query_engine<'a>(configuration: &'a ParsedConfiguration, env: &'a

let class = env.find_class("com/hasura/CalciteQuery").unwrap();
let instance = env.new_object(class, "()V", &[]).unwrap();
println!("Creating query engine with configuration: {:?}", configuration);
let _ = create_jvm_connection(configuration, &instance, env).expect("Failed to create JVM connection");
event!(Level::INFO, "Instantiated Calcite Query Engine");
instance
Expand Down Expand Up @@ -179,25 +172,6 @@ pub fn create_jvm_connection<'a, 'b>(
}
}

// #[tracing::instrument(skip(configuration, env), level=Level::INFO)]
// pub fn create_query_engine<'a>(
// configuration: &'a ParsedConfiguration,
// mut env: JNIEnv<'a>
// ) -> Result<GlobalRef, Error> {
// let class = env.find_class("com/hasura/CalciteQuery")?;
// let instance = env.new_object(class, "()V", &[])?;

// match create_jvm_connection(configuration, &instance, &mut env) {
// Ok(_) => {
// event!(Level::INFO, "Instantiated Calcite Query Engine");
// Ok(env.new_global_ref(instance)?)
// },
// Err(_) => {
// Err(Error::JniCall(JniError::Unknown))
// }
// }
// }

#[tracing::instrument(skip(_environment,calcite_ref_singleton))]
pub async fn introspect(
args: &ParsedConfiguration,
Expand All @@ -210,7 +184,6 @@ pub async fn introspect(
}
let calcite_ref = calcite_ref_singleton.get().unwrap();
let metadata = get_models(calcite_ref);
println!("Metadata: {:?}", metadata);
let introspected = ParsedConfiguration {
version: Version::This,
_schema: args._schema.clone(),
Expand Down Expand Up @@ -253,7 +226,6 @@ pub async fn parse_configuration(
Ok(parsed_config)
}


/// Write the parsed configuration into a directory on disk.
#[tracing::instrument(skip(out_dir))]
pub async fn write_parsed_configuration(
Expand All @@ -264,8 +236,6 @@ pub async fn write_parsed_configuration(
let configuration_file = out_dir.as_ref().to_owned().join(CONFIGURATION_FILENAME);
fs::create_dir_all(out_dir.as_ref()).await?;

println!("Writing configuration to: {:?}", configuration_file);

// create the configuration file
fs::write(
configuration_file,
Expand Down
1 change: 1 addition & 0 deletions crates/connectors/ndc-calcite/src/connector/calcite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ impl Connector for Calcite {
calcite_ref = env.new_global_ref(calcite).unwrap();
}

// add check for key in configuration
let schema = retrieve_schema(configuration, calcite_ref.clone());
match schema {
Ok(schema) => Ok(JsonResponse::from(schema)),
Expand Down

0 comments on commit 67f5e60

Please sign in to comment.