cube-js/cube · error

Analyze is not supported

Error message

Analyze is not supported

What it means

CubeSQL's legacy SQL planner converts a DataFusion LogicalPlan into Cube's internal logical plan. LogicalPlan::Analyze nodes (produced by EXPLAIN ANALYZE execution plans) have no conversion, so add_logical_plan_replace_params panics deliberately rather than produce an incorrect plan.

Source

Thrown at rust/cubesql/cubesql/src/compile/rewrite/converter.rs:817

                let skip = add_data_node!(self, limit.skip, LimitSkip);
                let fetch = add_data_node!(self, limit.fetch, LimitFetch);
                let input =
                    self.add_logical_plan_replace_params(limit.input.as_ref(), query_params, ctx)?;
                self.graph
                    .add(LogicalPlanLanguage::Limit([skip, fetch, input]))
            }
            LogicalPlan::Values(values) => {
                let values = add_data_node!(self, values.values, ValuesValues);
                self.graph.add(LogicalPlanLanguage::Values([values]))
            }
            LogicalPlan::CreateExternalTable { .. } => {
                panic!("CreateExternalTable is not supported");
            }
            LogicalPlan::Explain { .. } => {
                panic!("Explain is not supported");
            }
            LogicalPlan::Analyze { .. } => {
                panic!("Analyze is not supported");
            }
            // TODO
            LogicalPlan::Extension(ext) => {
                panic!("Unsupported extension node: {}", ext.node.schema());
            }
            LogicalPlan::Distinct(distinct) => {
                let input = self.add_logical_plan_replace_params(
                    distinct.input.as_ref(),
                    query_params,
                    ctx,
                )?;
                self.graph.add(LogicalPlanLanguage::Distinct([input]))
            }
            // TODO: Support all
            _ => unimplemented!("Unsupported node type: {:?}", plan),
        })
    }
    fn find_source_table_name(&self, plan: &LogicalPlan) -> Result<Option<String>, CubeError> {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Remove EXPLAIN ANALYZE and run the query normally, or use plain EXPLAIN if supported upstream
  2. Check CubeSQL version for support of explain analyze; upgrade Cube/CubeSQL
  3. If you control the caller, strip Analyze nodes before handing the plan to the converter

Example fix

// before
EXPLAIN ANALYZE SELECT count(*) FROM orders;
// after
SELECT count(*) FROM orders;
Defensive patterns

Strategy: validation

Validate before calling

// Caller-side (SQL): detect unsupported EXPLAIN ANALYZE before sending
fn assert_no_explain_analyze(sql: &str) -> Result<(), String> {
    let lower = sql.to_lowercase();
    if lower.contains("explain analyze") {
        Err("EXPLAIN ANALYZE is not supported by CubeSQL planner".into())
    } else { Ok(()) }
}

Prevention

When it happens

Trigger: A DataFusion LogicalPlan containing an Analyze node is passed to add_logical_plan / plan — typically when EXPLAIN ANALYZE is executed against a query that reaches the rewrite converter.

Common situations: Running EXPLAIN ANALYZE through the CubeSQL Postgres wire protocol; internal tooling that instruments query plans; client drivers that prepend EXPLAIN ANALYZE for profiling.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/6422602b1450cf87. Report an issue: GitHub.