Skip to content

Commit 42c68da

Browse files
authored
chore(cubesql): Pass span_id to logical plan creation function (#10056)
Signed-off-by: Alex Qyoun-ae <[email protected]>
1 parent 32df746 commit 42c68da

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

rust/cubesql/cubesql/src/compile/query_engine.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ pub trait QueryEngine {
8080
&self,
8181
cube_ctx: &CubeContext,
8282
stmt: &Self::AstStatementType,
83+
span_id: Option<Arc<SpanId>>,
84+
query_planning_id: Option<Uuid>,
8385
) -> Result<(LogicalPlan, Self::PlanMetadataType), DataFusionError>;
8486

8587
fn sanitize_statement(&self, stmt: &Self::AstStatementType) -> Self::AstStatementType;
@@ -122,18 +124,20 @@ pub trait QueryEngine {
122124
let ctx = self.create_session_ctx(state.clone())?;
123125
let cube_ctx = self.create_cube_ctx(state.clone(), meta.clone(), ctx.clone())?;
124126

125-
let (plan, metadata) = self.create_logical_plan(&cube_ctx, &stmt).map_err(|err| {
126-
let message = format!("Initial planning error: {}", err,);
127-
let meta = Some(HashMap::from([
128-
("query".to_string(), stmt.to_string()),
129-
(
130-
"sanitizedQuery".to_string(),
131-
self.sanitize_statement(&stmt).to_string(),
132-
),
133-
]));
127+
let (plan, metadata) = self
128+
.create_logical_plan(&cube_ctx, &stmt, span_id.clone(), Some(query_planning_id))
129+
.map_err(|err| {
130+
let message = format!("Initial planning error: {}", err,);
131+
let meta = Some(HashMap::from([
132+
("query".to_string(), stmt.to_string()),
133+
(
134+
"sanitizedQuery".to_string(),
135+
self.sanitize_statement(&stmt).to_string(),
136+
),
137+
]));
134138

135-
CompilationError::internal(message).with_meta(meta)
136-
})?;
139+
CompilationError::internal(message).with_meta(meta)
140+
})?;
137141

138142
let mut optimized_plan = plan;
139143
// ctx.optimize(&plan).map_err(|err| {
@@ -567,6 +571,8 @@ impl QueryEngine for SqlQueryEngine {
567571
&self,
568572
cube_ctx: &CubeContext,
569573
stmt: &Self::AstStatementType,
574+
_span_id: Option<Arc<SpanId>>,
575+
_query_planning_id: Option<Uuid>,
570576
) -> Result<(LogicalPlan, Self::PlanMetadataType), DataFusionError> {
571577
let df_query_planner = SqlToRel::new_with_options(cube_ctx, true);
572578
let plan =

0 commit comments

Comments
 (0)