cube-js/cube · error

Not implemented

Error message

Not implemented

What it means

The MAKEDATE scalar UDF in CubeSQL is registered with a stub implementation: its body is todo!("Not implemented"), which panics if the function is actually evaluated. Registration exists for planning/compatibility, but execution is unsupported.

Source

Thrown at rust/cubesql/cubesql/src/compile/engine/udf/common.rs:953

    let return_type: ReturnTypeFunction = Arc::new(move |_| Ok(Arc::new(DataType::Date32)));

    ScalarUDF::new(
        "date",
        &Signature::uniform(
            1,
            vec![
                DataType::Timestamp(TimeUnit::Nanosecond, None),
                DataType::Utf8,
            ],
            Volatility::Immutable,
        ),
        &return_type,
        &fun,
    )
}

pub fn create_makedate_udf() -> ScalarUDF {
    let fun = make_scalar_function(move |_args: &[ArrayRef]| todo!("Not implemented"));

    let return_type: ReturnTypeFunction = Arc::new(move |_| Ok(Arc::new(DataType::Date32)));

    ScalarUDF::new(
        "makedate",
        &Signature::exact(
            vec![DataType::Int64, DataType::Int64],
            Volatility::Immutable,
        ),
        &return_type,
        &fun,
    )
}

pub fn create_year_udf() -> ScalarUDF {
    let fun = make_scalar_function(move |_args: &[ArrayRef]| todo!("Not implemented"));

    let return_type: ReturnTypeFunction = Arc::new(move |_| Ok(Arc::new(DataType::Int64)));

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Rewrite the query to construct dates without MAKEDATE, e.g. CAST(concat(year, '-01-01') AS DATE) + interval arithmetic or make_date equivalents supported by the engine
  2. Push the computation into the underlying database instead of CubeSQL
  3. Track/implement the UDF in rust/cubesql/cubesql/src/compile/engine/udf/common.rs

Example fix

-- before
SELECT MAKEDATE(2024, 60);
-- after
SELECT DATE '2024-01-01' + INTERVAL '59 days';
Defensive patterns

Strategy: try-catch

Validate before calling

// detect unsupported UDF before sending SQL
const UNSUPPORTED = /\bMAKEDATE\s*\(/i;
if (UNSUPPORTED.test(sql)) throw new Error('MAKEDATE is not implemented in CubeSQL; rewrite the query');

Try / catch

try {
  return await cube.sqlApi.query(sql);
} catch (e) {
  if (String(e).includes('Not implemented')) {
    return await cube.sqlApi.query(rewriteWithoutMakedate(sql));
  }
  throw e;
}

Prevention

When it happens

Trigger: Running a SQL query that evaluates MAKEDATE(year, day) through CubeSQL's Postgres-compatible interface, forcing the UDF's compute path.

Common situations: Porting MySQL queries using MAKEDATE to Cube; BI tools generating MAKEDATE in date dimension SQL.

Related errors


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