Skip to content

Commit

Permalink
Removed some references to calcite to clean up the trace logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenstott committed Sep 17, 2024
1 parent 7373921 commit 9c6ba36
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions crates/calcite-schema/src/version5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl CalciteRefSingleton {
crate::configuration::ParsedConfiguration::Version5(config) => {
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_calcite_query_engine(&config, env).map_err(| _ | "Could not create Calcite Query Engine") ?;
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")
}
}
Expand Down Expand Up @@ -107,7 +107,7 @@ impl ParsedConfiguration {
}

#[tracing::instrument(skip(configuration, calcite_query, env), level=Level::INFO)]
pub fn create_calcite_connection<'a, 'b>(
pub fn create_jvm_connection<'a, 'b>(
configuration: &'a ParsedConfiguration,
calcite_query: &'b JObject,
env: &'b mut JNIEnv<'a>,
Expand Down Expand Up @@ -136,7 +136,7 @@ pub fn create_calcite_connection<'a, 'b>(
}

#[tracing::instrument(skip(configuration, env), level=Level::INFO)]
pub fn create_calcite_query_engine<'a>(
pub fn create_query_engine<'a>(
configuration: &'a ParsedConfiguration,
mut env: JNIEnv<'a>
) -> Result<GlobalRef, Error> {
Expand All @@ -151,7 +151,7 @@ pub fn create_calcite_query_engine<'a>(
Err(e) => return Err(e),
};

match create_calcite_connection(configuration, &instance, &mut env) {
match create_jvm_connection(configuration, &instance, &mut env) {
Ok(_) => {
event!(Level::INFO, "Instantiated Calcite Query Engine");
Ok(env.new_global_ref(instance)?)
Expand Down
12 changes: 6 additions & 6 deletions crates/connectors/ndc-calcite/src/calcite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tracing::{event, Level, Span};
use tracing_opentelemetry::OpenTelemetrySpanExt;

use ndc_calcite_schema::jvm::get_jvm;
use ndc_calcite_schema::version5::create_calcite_connection;
use ndc_calcite_schema::version5::create_jvm_connection;
use ndc_calcite_schema::version5::ParsedConfiguration;

pub type Row = IndexMap<FieldName, RowFieldValue>;
Expand All @@ -44,22 +44,22 @@ pub type Row = IndexMap<FieldName, RowFieldValue>;
/// use jni::JNIEnv;
/// use jni::objects::JObject;
/// use tracing::Level;
/// use ndc_calcite_schema::version5::{create_calcite_connection, ParsedConfiguration};
/// use ndc_calcite_schema::version5::{create_jvm_connection, ParsedConfiguration};
///
/// #[tracing::instrument(skip(configuration, env))]
/// pub fn create_calcite_query_engine<'a>(configuration: &ParsedConfiguration, env: &'a mut JNIEnv<'a>) -> JObject<'a> {
/// pub fn create_query_engine<'a>(configuration: &ParsedConfiguration, env: &'a mut JNIEnv<'a>) -> JObject<'a> {
/// let class = env.find_class("org/kenstott/CalciteQuery").unwrap();
/// let instance = env.new_object(class, "()V", &[]).unwrap();
/// let _ = create_calcite_connection(configuration, &instance, env);
/// let _ = create_jvm_connection(configuration, &instance, env);
/// event!(Level::INFO, "Instantiated Calcite Query Engine");
/// return instance;
/// }
/// ```
#[tracing::instrument(skip(configuration, env), level = Level::INFO)]
pub fn create_calcite_query_engine<'a>(configuration: &'a ParsedConfiguration, env: &'a mut JNIEnv<'a>) -> JObject<'a> {
pub fn create_query_engine<'a>(configuration: &'a ParsedConfiguration, env: &'a mut JNIEnv<'a>) -> JObject<'a> {
let class = env.find_class("org/kenstott/CalciteQuery").unwrap();
let instance = env.new_object(class, "()V", &[]).unwrap();
let _ = create_calcite_connection(configuration, &instance, env);
let _ = create_jvm_connection(configuration, &instance, env);
event!(Level::INFO, "Instantiated Calcite Query Engine");
return instance;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/connectors/ndc-calcite/src/connector/calcite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl Connector for Calcite {
{
let java_vm = get_jvm().lock().unwrap();
let mut env = java_vm.attach_current_thread_as_daemon().unwrap();
calcite = calcite::create_calcite_query_engine(configuration, &mut env);
calcite = calcite::create_query_engine(configuration, &mut env);
let env = java_vm.attach_current_thread_as_daemon().unwrap();
calcite_ref = env.new_global_ref(calcite).unwrap();
}
Expand Down Expand Up @@ -330,7 +330,7 @@ fn init_state(
let calcite_ref;
{
let mut env = java_vm.attach_current_thread_as_daemon().unwrap();
calcite = calcite::create_calcite_query_engine(configuration, &mut env);
calcite = calcite::create_query_engine(configuration, &mut env);
let env = java_vm.attach_current_thread_as_daemon().unwrap();
calcite_ref = env.new_global_ref(calcite).unwrap();
}
Expand Down

0 comments on commit 9c6ba36

Please sign in to comment.