Skip to content

Invalid SQL queries for Apache Druid #2149

@adammruk

Description

@adammruk

Describe the bug
When using Druid adapter, CubeJS is creating invalid SQL queries, which prevents to use CubeJS with Druid DB.

  1. Repetitive error in console:
    When connected to Druid database, in CubeJS backend terminal throws this error every ~30s:
{} 
Error: org.apache.calcite.runtime.CalciteContextException: From line 1, column 34 to line 1, column 38: No match found for function signature NOW()
    at QueryQueue.parseResult (<CubeJS backend path>/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/QueryQueue.js:100:13)
    at QueryQueue.executeInQueue (<CubeJS backend path>/node_modules/@cubejs-backend/query-orchestrator/src/orchestrator/QueryQueue.js:89:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
    at OrchestratorApi.executeQuery (<CubeJS backend path>/node_modules/@cubejs-backend/server-core/src/core/OrchestratorApi.ts:40:20)
    at <CubeJS backend path>/node_modules/@cubejs-backend/server-core/src/core/RefreshScheduler.ts:158:9
    at async Promise.all (index 0)
    at <CubeJS backend path>/node_modules/@cubejs-backend/server-core/src/core/RefreshScheduler.ts:143:7
    at async Promise.all (index 1)

Which actually seems to be correct error, cause in Druid there's no such query like NOW() (for current time, there's CURRENT_TIMESTAMP for example)

  1. Another SQL error is with creating some example chart. In playground, after select Measure > Wikipedia Count, following error is visible:

obraz

To Reproduce
Steps to reproduce the behavior:

  1. Install Apache Druid DB, and load wikipedia example data, as described in https://druid.apache.org/docs/latest/tutorials/index.html
  2. Install CubeJS for Druid database: npx cubejs-cli create cubejs -d druid
  3. Set .env file:
CUBEJS_DB_URL="http://localhost:8082"
CUBEJS_DB_USER=""
CUBEJS_DB_PASS=""
  1. npm install
  2. npm run dev
  3. Go to the playground (http://localhost:4000/#/schema), and in "Schema" tab generate Schema:
    obraz
  4. Go to "Build" tab
  5. From "Measures" select "Wikipedia Count"
  6. Error with invalid query is visible in Playground, and in terminal every ~30s error with NOW() is visible.

Expected behavior
I should be able to use Druid Database without any errors

Version:
From npm list | grep @cubejs-backend:

├─┬ @cubejs-backend/druid-driver@0.26.16
│ ├─┬ @cubejs-backend/query-orchestrator@0.26.16
│ │ ├── @cubejs-backend/shared@0.26.16 deduped
│ ├─┬ @cubejs-backend/schema-compiler@0.26.16
│ ├─┬ @cubejs-backend/shared@0.26.16
└─┬ @cubejs-backend/server@0.26.16
  ├── @cubejs-backend/dotenv@9.0.2
  ├─┬ @cubejs-backend/server-core@0.26.16
  │ ├─┬ @cubejs-backend/api-gateway@0.26.16
  │ │ ├── @cubejs-backend/shared@0.26.16 deduped
  │ ├── @cubejs-backend/query-orchestrator@0.26.16 deduped
  │ ├── @cubejs-backend/schema-compiler@0.26.16 deduped
  │ ├── @cubejs-backend/shared@0.26.16 deduped
  ├── @cubejs-backend/shared@0.26.16 deduped

Additional context
OS: macOS Big Sur 11.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugLEGACY. Use the Bug issue type insteadhelp wantedCommunity contributions are welcome.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions