{"record":{"id":"730f618c93997bfb","repo":"cube-js/cube","slug":"not-implemented-yet","errorCode":null,"errorMessage":"Not implemented yet","messagePattern":"Not implemented yet","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"packages/cubejs-schema-compiler/src/adapter/CrateQuery.ts","lineNumber":6,"sourceCode":"import { PostgresQuery } from './PostgresQuery';\nimport { UserError } from '../compiler/UserError';\n\nexport class CrateQuery extends PostgresQuery {\n  public hllInit(_sql): string {\n    throw new UserError('Not implemented yet');\n  }\n\n  public hllMerge(_sql): string {\n    throw new UserError('Not implemented yet');\n  }\n\n  public countDistinctApprox(sql: string): string {\n    return `hyperloglog_distinct(${sql})`;\n  }\n\n  public sqlTemplates() {\n    const templates = super.sqlTemplates();\n    delete templates.functions.WIDTH_BUCKET;\n    return templates;\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-schema-compiler/src/adapter/CrateQuery.ts#L1-L23","documentation":"CrateDB adapter inherits Postgres but does not implement HLL (HyperLogLog) initialization SQL, so hllInit unconditionally throws 'Not implemented yet'. Approximate distinct counting that requires HLL init on the source dialect cannot run on CrateDB.","triggerScenarios":"Calling countDistinctApprox-adjacent SQL generation that routes to hllInit on a CrateDB datasource — typically when an approximate distinct measure (approximateUnique style) triggers HLL aggregation in a sub-query.","commonSituations":"Using approximate distinct count measures in a project pointed at CrateDB; porting a Postgres schema using HLL extensions to CrateDB.","solutions":["Use exact distinct count instead of the approximate variant (plain `type: 'countDistinct'`).","Use CrateDB's native `hyperloglog_distinct` path via countDistinctApprox which is implemented (hllMerge/hllInit are not).","Contribute an implementation of hllInit in a custom query subclass extending CrateQuery."],"exampleFix":"// before\nmeasures: { users: { type: 'countDistinctApprox', sql: `${CUBE}.userId` } }\n// after\nmeasures: { users: { type: 'countDistinct', sql: `${CUBE}.userId` } }","handlingStrategy":"fallback","validationCode":"if (dbType === 'cratedb' && measure.type === 'countDistinctApprox') {\n  console.warn('HLL init not implemented for CrateDB; use countDistinct');\n}","typeGuard":null,"tryCatchPattern":"try { await cube.load(q) } catch (e) { if (/Not implemented yet/.test(e.message)) { return cube.load({ ...q, measures: exactMeasures }); } throw e; }","preventionTips":["Check dialect support for approximate counts before adopting countDistinctApprox","Use exact countDistinct on CrateDB","Review adapter subclass overrides before porting schemas"],"tags":["cratedb","hyperloglog","not-implemented","approximate-count"],"backgroundTag":"feature-not-implemented","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}