cube-js / cube-js/cube

Elasticsearch create tables in source database for pre-aggregations

Open
#2,926 1 comment 0 reactions 1 assignee Claimed by @ovr View on GitHub
pre-aggregations
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

In my cube schema, I have mentioned that the cube js should use cubestore for pre-aggregations

```
preAggregations: {
main: {
type: `rollup`,
external: true,
measureReferences: [sales],
dimensionReferences: [category]
}
}
```
I have also mentioned the Cubestore host while creating the docker
```
docker run -d
-e CUBEJS_DB_URL=http://localhost:9200
-e CUBEJS_DB_TYPE=elasticsearch
-e CUBEJS_DB_ELASTIC_QUERY_FORMAT=json
-e CUBEJS_REDIS_USE_IOREDIS=true
-e CUBEJS_API_SECRET=anything
-e CUBEJS_CUBESTORE_HOST=localhost
-e CUBEJS_REDIS_URL=redis://localhost:6379
--network=host
-v /home/ubuntu/apps/cube_docker_conf:/cube/conf
-it --restart=unless-stopped
cubejs/cube:latest
```

But even with this, the system is trying to create tables in elasticsearch's database instead of the cube store causing errors

But elasticsearch doesn't have support for the create table command
```
{"message":"Error while querying","processingId":"6","queueSize":1,"duration":123,"queryKey":[["CREATE TABLE prod_pre_aggregations.abdd1609f28f44e1f920ed80a255ae426_main AS SELECT\n abdd1609f28f44e1f920ed80a255ae426.category abdd1609f28f44e1f920ed80a255ae426__category, sum(abdd1609f28f44e1f920ed80a255ae426.sales) abdd1609f28f44e1f920ed80a255ae426__sales\n FROM\n abdd1609f28f44e1f920ed80a255ae426 AS abdd1609f28f44e1f920ed80a255ae426 GROUP BY abdd1609f28f44e1f920ed80a255ae426.category",[]],[[{"MAX(ship_date)":"2019-11-17T00:00:00.000Z"}]]],"queuePrefix":"SQL_PRE_AGGREGATIONS_STANDALONE_default","requestId":"4bad6083-8724-4ff5-b15c-0cf384c8600e","timeInQueue":12,"error":"Error: {\n \"error\": {\n \"root_cause\": [\n {\n \"type\": \"parsing_exception\",\n \"reason\": \"line 1:43: extraneous input '.' expecting {, ',', 'ANALYZE', 'ANALYZED', 'AS', 'CATALOGS', 'COLUMNS', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'DAY', 'DEBUG', 'EXECUTABLE', 'EXPLAIN', 'FIRST', 'FORMAT', 'FULL', 'FUNCTIONS', 'GRAPHVIZ', 'GROUP', 'HAVING', 'HOUR', 'INNER', 'INTERVAL', 'JOIN', 'LAST', 'LEFT', 'LIMIT', 'MAPPED', 'MINUTE', 'MONTH', 'NATURAL', 'OPTIMIZED', 'ORDER', 'PARSED', 'PHYSICAL', 'PIVOT', 'PLAN', 'RIGHT', 'RLIKE', 'QUERY', 'SCHEMAS', 'SECOND', 'SHOW', 'SYS', 'TABLES', 'TEXT', 'TYPE', 'TYPES', 'VERIFY', 'WHERE', 'YEAR', LIMIT_ESC, IDENTIFIER, DIGIT_IDENTIFIER, QUOTED_IDENTIFIER, BACKQUOTED_IDENTIFIER}\"\n }\n ],\n \"type\": \"parsing_exception\",\n \"reason\": \"line 1:43: extraneous input '.' expecting {, ',', 'ANALYZE', 'ANALYZED', 'AS', 'CATALOGS', 'COLUMNS', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'DAY', 'DEBUG', 'EXECUTABLE', 'EXPLAIN', 'FIRST', 'FORMAT', 'FULL', 'FUNCTIONS', 'GRAPHVIZ', 'GROUP', 'HAVING', 'HOUR', 'INNER', 'INTERVAL', 'JOIN', 'LAST', 'LEFT', 'LIMIT', 'MAPPED', 'MINUTE', 'MONTH', 'NATURAL', 'OPTIMIZED', 'ORDER', 'PARSED', 'PHYSICAL', 'PIVOT', 'PLAN', 'RIGHT', 'RLIKE', 'QUERY', 'SCHEMAS', 'SECOND', 'SHOW', 'SYS', 'TABLES', 'TEXT', 'TYPE', 'TYPES', 'VERIFY', 'WHERE', 'YEAR', LIMIT_ESC, IDENTIFIER, DIGIT_IDENTIFIER, QUOTED_IDENTIFIER, BACKQUOTED_IDENTIFIER}\"\n },\n \"status\": 400\n}\n at ElasticSearchDriver.query (/cube/node_modules/@cubejs-backend/elasticsearch-driver/driver/ElasticSearchDriver.js:96:15)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.