Skip to content

Commit

Permalink
Remove cluster adaptation for tables to pass tests
Browse files Browse the repository at this point in the history
  • Loading branch information
volum-nova committed Jan 24, 2023
1 parent 50112e7 commit 90a3ac4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
@@ -1,10 +1,10 @@
DROP TABLE IF EXISTS driver_ratings ON CLUSTER cluster_1;
DROP TABLE IF EXISTS user_ratings ON CLUSTER cluster_1;
DROP TABLE IF EXISTS orders ON CLUSTER cluster_1;
DROP TABLE IF EXISTS driver_ratings_queue ON CLUSTER cluster_1;
DROP TABLE IF EXISTS user_ratings_queue ON CLUSTER cluster_1;
DROP TABLE IF EXISTS orders_queue ON CLUSTER cluster_1;
DROP VIEW IF EXISTS user_ratings_queue_mv ON CLUSTER cluster_1;
DROP VIEW IF EXISTS driver_ratings_queue_mv ON CLUSTER cluster_1;
DROP VIEW IF EXISTS orders_queue_mv ON CLUSTER cluster_1;
DROP DATABASE IF EXISTS analytics ON CLUSTER cluster_1;
DROP TABLE IF EXISTS driver_ratings;
DROP TABLE IF EXISTS user_ratings;
DROP TABLE IF EXISTS orders;
DROP TABLE IF EXISTS driver_ratings_queue;
DROP TABLE IF EXISTS user_ratings_queue;
DROP TABLE IF EXISTS orders_queue;
DROP VIEW IF EXISTS user_ratings_queue_mv;
DROP VIEW IF EXISTS driver_ratings_queue_mv;
DROP VIEW IF EXISTS orders_queue_mv;
DROP DATABASE IF EXISTS analytics;
26 changes: 13 additions & 13 deletions database/clickhouse/examples/migrations/003_create_database.up.sql
@@ -1,16 +1,16 @@
CREATE DATABASE IF NOT EXISTS analytics ON CLUSTER cluster_1;
CREATE DATABASE IF NOT EXISTS analytics;

CREATE TABLE IF NOT EXISTS analytics.driver_ratings ON CLUSTER cluster_1(
CREATE TABLE IF NOT EXISTS analytics.driver_ratings(
rate UInt8,
userID Int64,
driverID String,
orderID String,
inserted_time DateTime DEFAULT now()
) ENGINE = ReplicatedMergeTree
) ENGINE = MergeTree
PARTITION BY driverID
ORDER BY (inserted_time);

CREATE TABLE analytics.driver_ratings_queue ON CLUSTER cluster_1(
CREATE TABLE analytics.driver_ratings_queue(
rate UInt8,
userID Int64,
driverID String,
Expand All @@ -22,21 +22,21 @@ SETTINGS kafka_broker_list = 'broker:9092',
kafka_format = 'Avro',
kafka_max_block_size = 1048576;

CREATE MATERIALIZED VIEW analytics.driver_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.driver_ratings AS
CREATE MATERIALIZED VIEW analytics.driver_ratings_queue_mv TO analytics.driver_ratings AS
SELECT rate, userID, driverID, orderID
FROM analytics.driver_ratings_queue;

CREATE TABLE IF NOT EXISTS analytics.user_ratings ON CLUSTER cluster_1(
CREATE TABLE IF NOT EXISTS analytics.user_ratings(
rate UInt8,
userID Int64,
driverID String,
orderID String,
inserted_time DateTime DEFAULT now()
) ENGINE = ReplicatedMergeTree
) ENGINE = MergeTree
PARTITION BY userID
ORDER BY (inserted_time);

CREATE TABLE analytics.user_ratings_queue ON CLUSTER cluster_1(
CREATE TABLE analytics.user_ratings_queue(
rate UInt8,
userID Int64,
driverID String,
Expand All @@ -48,22 +48,22 @@ SETTINGS kafka_broker_list = 'broker:9092',
kafka_format = 'JSON',
kafka_max_block_size = 1048576;

CREATE MATERIALIZED VIEW analytics.user_ratings_queue_mv ON CLUSTER cluster_1 TO analytics.user_ratings AS
CREATE MATERIALIZED VIEW analytics.user_ratings_queue_mv TO analytics.user_ratings AS
SELECT rate, userID, driverID, orderID
FROM analytics.user_ratings_queue;

CREATE TABLE IF NOT EXISTS analytics.orders ON CLUSTER cluster_1(
CREATE TABLE IF NOT EXISTS analytics.orders(
from_place String,
to_place String,
userID Int64,
driverID String,
orderID String,
inserted_time DateTime DEFAULT now()
) ENGINE = ReplicatedMergeTree
) ENGINE = MergeTree
PARTITION BY driverID
ORDER BY (inserted_time);

CREATE TABLE analytics.orders_queue ON CLUSTER cluster_1(
CREATE TABLE analytics.orders_queue(
from_place String,
to_place String,
userID Int64,
Expand All @@ -76,6 +76,6 @@ SETTINGS kafka_broker_list = 'broker:9092',
kafka_format = 'Avro',
kafka_max_block_size = 1048576;

CREATE MATERIALIZED VIEW analytics.orders_queue_mv ON CLUSTER cluster_1 TO orders AS
CREATE MATERIALIZED VIEW analytics.orders_queue_mv TO orders AS
SELECT from_place, to_place, userID, driverID, orderID
FROM analytics.orders_queue;

0 comments on commit 90a3ac4

Please sign in to comment.