From cee6ba965eb8656dde7d73b71cdf28d23fb09d4c Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Thu, 26 Sep 2024 19:03:39 -0700 Subject: [PATCH 01/11] WIP --- .../create.table.with.includes/client.rpt | 121 +++++++++++++++- .../create.table.with.includes/server.rpt | 137 ++++++++++++++++-- .../create.table.with.primary.key/client.rpt | 110 +++++++++++++- .../create.table.with.primary.key/server.rpt | 121 ++++++++++++++-- .../streams/effective/create.table/client.rpt | 120 ++++++++++++++- .../streams/effective/create.table/server.rpt | 102 ++++++++++++- 6 files changed, 658 insertions(+), 53 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt index 10aa0d39ab..0bdd022789 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt @@ -32,10 +32,10 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS weather (*)\n" - "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" - "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" +write "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" + "INCLUDE timestamp AS timestamp,\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -62,6 +62,114 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW weather_view AS\n" + " SELECT city, temperature, date," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity, + " timestamp FROM streampay_users_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE weather(" + " city VARCHAR, temperature DOUBLE, date DATE, + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " PRIMARY KEY (city, temperature, date));" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_view_sink INTO weather FROM weather_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_sink\n" + "FROM weather\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.weather',\n" + " properties.bootstrap.server='localhost:9092',\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + connect "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" @@ -81,8 +189,9 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TOPIC IF NOT EXISTS weather " - "(city VARCHAR, temperature DOUBLE, date DATE);" +write "CREATE TOPIC IF NOT EXISTS weather" + " (city VARCHAR, temperature DOUBLE, date DATE," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" [0x00] write flush diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt index ff8e4dec8c..cfad803203 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt @@ -36,20 +36,20 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SOURCE IF NOT EXISTS weather (*)\n" - "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" - "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] +read "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" + "INCLUDE timestamp AS timestamp,\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) @@ -65,6 +65,110 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW weather_view AS\n" + " SELECT city, temperature, date," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity, + " timestamp FROM streampay_users_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE weather(" + " city VARCHAR, temperature DOUBLE, date DATE, + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " PRIMARY KEY (city, temperature, date));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_view_sink INTO weather FROM weather_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_sink\n" + "FROM weather\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.weather',\n" + " properties.bootstrap.server='localhost:9092',\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + accept "zilla://streams/app2" option zilla:window 8192 @@ -87,8 +191,9 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TOPIC IF NOT EXISTS weather " - "(city VARCHAR, temperature DOUBLE, date DATE);" +read "CREATE TOPIC IF NOT EXISTS weather" + " (city VARCHAR, temperature DOUBLE, date DATE," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" [0x00] write advise zilla:flush ${pgsql:flushEx() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt index be0c185f67..f8711e888e 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt @@ -32,22 +32,64 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (key)\n" - ")\n" - "INCLUDE KEY AS key\n" +write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" " topic='dev.cities',\n" " scan.startup.mode='latest',\n" " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT UPSERT ENCODE AVRO (\n" + ") FORMAT PLAIN ENCODE AVRO (\n" " schema.registry = 'http://localhost:8081'\n" ");" [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -64,12 +106,65 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_sink\n" + "FROM cities\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} connect "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" - write zilla:begin.ext ${pgsql:beginEx() .typeId(zilla:id("pgsql")) .parameter("user", "root") @@ -103,4 +198,3 @@ read advised zilla:flush ${pgsql:flushEx() .status("IDLE") .build() .build()} - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt index 7554c745e1..0dabd84b97 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt @@ -36,26 +36,120 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (key)\n" - ")\n" - "INCLUDE KEY AS key\n" +read "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_sink\n" + "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.cities',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " schema.registry = 'http://localhost:8081'\n" ");" [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_SINK") .build() .build()} @@ -66,6 +160,7 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} + accept "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" @@ -106,5 +201,3 @@ write advise zilla:flush ${pgsql:flushEx() .status("IDLE") .build() .build()} - - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt index 5635455b3c..f2ebc902c1 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt @@ -32,15 +32,119 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS weather (*)\n" +write "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW weather_view AS SELECT * FROM weather_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE weather(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date)" + ")" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_view_sink INTO weather FROM weather_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_sink\n" + "FROM weather\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" + " connector='kafka',\n" + " topic='dev.weather',\n" + " properties.bootstrap.server='localhost:9092',\n" ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" ");" [0x00] write flush @@ -48,7 +152,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_SOURCE") + .tag("CREATE_SINK") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt index 52a524dbc4..829584d4e7 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt @@ -36,7 +36,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SOURCE IF NOT EXISTS weather (*)\n" +read "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -62,6 +62,106 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW weather_view AS SELECT * FROM weather_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE weather(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date)" + ")" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_view_sink INTO weather FROM weather_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_sink\n" + "FROM weather\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.weather',\n" + " properties.bootstrap.server='localhost:9092',\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + accept "zilla://streams/app2" option zilla:window 8192 From 1718164ceba3ff2c6e62818f611e7f3ba13683a7 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Tue, 1 Oct 2024 12:37:53 -0700 Subject: [PATCH 02/11] WIP --- .../create.table.with.includes/client.rpt | 13 +- .../create.table.with.includes/server.rpt | 2 +- .../server.rpt | 141 +++++++++++++++--- .../streams/effective/create.table/client.rpt | 3 +- .../streams/effective/create.table/server.rpt | 3 +- 5 files changed, 131 insertions(+), 31 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt index 0bdd022789..9e4057d926 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt @@ -71,7 +71,7 @@ write "CREATE MATERIALIZED VIEW weather_view AS\n" " SELECT city, temperature, date," " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM streampay_users_source;" + " timestamp FROM weather_source;" [0x00] write flush @@ -98,7 +98,7 @@ write "CREATE TABLE weather(" " city VARCHAR, temperature DOUBLE, date DATE, " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (city, temperature, date));" - [0x00] + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -121,7 +121,7 @@ write zilla:data.ext ${pgsql:dataEx() .build() .build()} write "CREATE SINK weather_view_sink INTO weather FROM weather_view;" - [0x00] + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -189,11 +189,10 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TOPIC IF NOT EXISTS weather" - " (city VARCHAR, temperature DOUBLE, date DATE," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" +write "CREATE TOPIC IF NOT EXISTS weather" + " (city VARCHAR, temperature DOUBLE, date DATE," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" [0x00] - write flush read advised zilla:flush ${pgsql:flushEx() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt index cfad803203..2ae261fc5d 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt @@ -74,7 +74,7 @@ read "CREATE MATERIALIZED VIEW weather_view AS\n" " SELECT city, temperature, date," " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM streampay_users_source;" + " timestamp FROM weather_source;" [0x00] write advise zilla:flush ${pgsql:flushEx() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt index 189026d000..267468d3c2 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt @@ -36,29 +36,131 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (id)\n" - ")\n" - "INCLUDE KEY AS key\n" - "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" - "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" +read "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" + "INCLUDE timestamp AS timestamp,\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" + [0x00] +read "CREATE MATERIALIZED VIEW cities_view AS\n" + " SELECT id, name, description," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity, + " timestamp FROM cities_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " PRIMARY KEY (id));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_sink\n" + "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.cities',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" ");" [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_SINK") .build() .build()} @@ -69,6 +171,7 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} + accept "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" @@ -91,7 +194,9 @@ read zilla:data.ext ${pgsql:dataEx() .build() .build()} read "CREATE TOPIC IF NOT EXISTS cities " - "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + "(id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP" + " PRIMARY KEY (id));" [0x00] write advise zilla:flush ${pgsql:flushEx() @@ -109,5 +214,3 @@ write advise zilla:flush ${pgsql:flushEx() .status("IDLE") .build() .build()} - - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt index f2ebc902c1..59299d78cc 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt @@ -89,8 +89,7 @@ write zilla:data.ext ${pgsql:dataEx() .build()} write "CREATE TABLE weather(\n" "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date)" - ")" + "PRIMARY KEY (city, temperature, date));" [0x00] write flush diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt index 829584d4e7..e1a1e750d6 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt @@ -91,8 +91,7 @@ read zilla:data.ext ${pgsql:dataEx() .build()} read "CREATE TABLE weather(\n" "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date)" - ")" + "PRIMARY KEY (city, temperature, date));" [0x00] write advise zilla:flush ${pgsql:flushEx() From 38b7050cd1d0d6fbe2eb167e311e4316ffcbffb6 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 13:38:48 -0700 Subject: [PATCH 03/11] WIP --- .../client.rpt | 141 +++++++++-- .../server.rpt | 5 +- .../streams/effective/create.table/server.rpt | 1 - .../effective/create.tables/client.rpt | 237 ++++++++++++++++-- .../effective/create.tables/server.rpt | 205 ++++++++++++++- 5 files changed, 544 insertions(+), 45 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt index f9451bc7bb..08fe7d1347 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt @@ -32,25 +32,73 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (id)\n" - ")\n" - "INCLUDE KEY AS key\n" - "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" - "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.cities',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" +write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" + "INCLUDE timestamp AS timestamp,\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW cities_view AS\n" + " SELECT id, name, description," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity, + " timestamp FROM cities_source;" [0x00] +write flush +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " PRIMARY KEY (id));" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -67,12 +115,65 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_sink\n" + "FROM cities\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} connect "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" - write zilla:begin.ext ${pgsql:beginEx() .typeId(zilla:id("pgsql")) .parameter("user", "root") @@ -89,7 +190,9 @@ write zilla:data.ext ${pgsql:dataEx() .build() .build()} write "CREATE TOPIC IF NOT EXISTS cities " - "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + "(id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " PRIMARY KEY (id));" [0x00] write flush diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt index 267468d3c2..61a0b16828 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt @@ -70,8 +70,6 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" - [0x00] read "CREATE MATERIALIZED VIEW cities_view AS\n" " SELECT id, name, description," " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," @@ -171,7 +169,6 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} - accept "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" @@ -195,7 +192,7 @@ read zilla:data.ext ${pgsql:dataEx() .build()} read "CREATE TOPIC IF NOT EXISTS cities " "(id VARCHAR, name VARCHAR, description VARCHAR," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP" + " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (id));" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt index e1a1e750d6..e6d7c47dc1 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt @@ -161,7 +161,6 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} - accept "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt index b277a9e5ba..9b00d908de 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt @@ -32,19 +32,154 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS weather_c (*)\n" +write "CREATE SOURCE IF NOT EXISTS weather_c_source (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather_c',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW weather_c_view AS SELECT * FROM weather_c_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE weather_c(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date));" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_c_view_sink INTO weather_c FROM weather_c_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_c_sink\n" + "FROM weather_c\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_c',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" + " connector='kafka',\n" + " topic='dev.weather_c',\n" + " properties.bootstrap.server='localhost:9092',\n" ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" ");" [0x00] write flush +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SOURCE IF NOT EXISTS weather_f_source (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather_f',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() @@ -64,15 +199,86 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS weather_f (*)\n" +write "CREATE MATERIALIZED VIEW weather_f_view AS SELECT * FROM weather_f_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE weather_f(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date));" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_f_view_sink INTO weather_f FROM weather_f_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK weather_f_sink\n" + "FROM weather_f\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_f',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" + " connector='kafka',\n" + " topic='dev.weather_f',\n" + " properties.bootstrap.server='localhost:9092',\n" ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" ");" [0x00] write flush @@ -80,7 +286,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_SOURCE") + .tag("CREATE_SINK") .build() .build()} @@ -130,7 +336,6 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} - write zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt index 819f65ae23..12f3dcd7b2 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt @@ -36,7 +36,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SOURCE IF NOT EXISTS weather_c (*)\n" +read "CREATE SOURCE IF NOT EXISTS weather_c_source (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -67,7 +67,106 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SOURCE IF NOT EXISTS weather_f (*)\n" +read "CREATE MATERIALIZED VIEW weather_c_view AS SELECT * FROM weather_c_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE weather_c(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_c_view_sink INTO weather_c FROM weather_c_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_c_sink\n" + "FROM weather_c\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.weather_c',\n" + " properties.bootstrap.server='localhost:9092',\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SOURCE IF NOT EXISTS weather_f_source (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -93,6 +192,104 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW weather_f_view AS SELECT * FROM weather_f_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE weather_f(\n" + "city VARCHAR, temperature DOUBLE, date DATE,\n + "PRIMARY KEY (city, temperature, date));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_f_view_sink INTO weather_f FROM weather_f_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK weather_f_sink\n" + "FROM weather_f\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.weather_f',\n" + " properties.bootstrap.server='localhost:9092',\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081',\n" + " force_append_only='true'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} accept "zilla://streams/app2" option zilla:window 8192 @@ -135,6 +332,7 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} + read zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() @@ -151,12 +349,9 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} -write notify CREATE_TOPIC_COMPLETED - write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .ready() .status("IDLE") .build() .build()} - From acbb8050d82bb02cceaea2e13d745249f4d913d3 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 13:41:12 -0700 Subject: [PATCH 04/11] WIP --- .../create.table.with.primary.key/server.rpt | 1 - .../query.with.multiple.statements/client.rpt | 108 +++++++++++++++- .../query.with.multiple.statements/server.rpt | 120 ++++++++++++++++-- 3 files changed, 210 insertions(+), 19 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt index 0dabd84b97..446eec99c9 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt @@ -160,7 +160,6 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} - accept "zilla://streams/app2" option zilla:window 8192 option zilla:transmission "duplex" diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt index ab484b7434..7c5bfb18d9 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt @@ -32,11 +32,7 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (id)\n" - ")\n" - "INCLUDE KEY AS key\n" +write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -49,6 +45,53 @@ write "CREATE TABLE IF NOT EXISTS cities (\n" [0x00] write flush +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + [0x00] +write flush + read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() @@ -63,6 +106,61 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SINK cities_sink\n" + "FROM cities\n" + "WITH (\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + write zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt index 39350568c4..42ed80dd3b 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt @@ -36,26 +36,120 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS cities (\n" - " *,\n" - " PRIMARY KEY (id)\n" - ")\n" - "INCLUDE KEY AS key\n" +read "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_MATERIALIZED_VIEW") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TABLE IF NOT EXISTS cities " + "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id));" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TABLE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_view_sink INTO cities FROM cities_view;" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SINK") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SINK cities_sink\n" + "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.cities',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" + " connector='kafka',\n" + " topic='dev.cities',\n" + " properties.bootstrap.server='localhost:9092',\n" + " primary_key='id'\n + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" ");" [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_SINK") .build() .build()} From 69482d7faf80502308921e16b7a53b56121d018e Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 14:30:46 -0700 Subject: [PATCH 05/11] Rename table without primary to stream --- .../create.stream.with.includes/client.rpt | 103 +++++ .../create.stream.with.includes/server.rpt | 109 ++++++ .../effective/create.stream/client.rpt | 100 +++++ .../effective/create.stream/server.rpt | 106 +++++ .../client.rpt | 120 ++---- .../server.rpt | 100 ++--- .../create.table.with.includes/client.rpt | 211 ---------- .../create.table.with.includes/server.rpt | 214 ----------- .../effective/create.tables/client.rpt | 362 ------------------ .../effective/create.tables/server.rpt | 357 ----------------- .../client.rpt | 4 +- .../server.rpt | 2 +- .../client.rpt | 4 +- .../server.rpt | 2 +- .../client.rpt | 2 +- .../server.rpt | 2 +- 16 files changed, 492 insertions(+), 1306 deletions(-) create mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt create mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt create mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/client.rpt create mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/server.rpt rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/{create.table => create.streams}/client.rpt (63%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/{create.table => create.streams}/server.rpt (68%) delete mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt delete mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt delete mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt delete mode 100644 incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.table.with.includes => create.stream.with.includes}/client.rpt (95%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.table.with.includes => create.stream.with.includes}/server.rpt (97%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.table => create.stream}/client.rpt (94%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.table => create.stream}/server.rpt (97%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.tables => create.streams}/client.rpt (98%) rename incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/{create.tables => create.streams}/server.rpt (98%) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt new file mode 100644 index 0000000000..10aa0d39ab --- /dev/null +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt @@ -0,0 +1,103 @@ +# +# Copyright 2021-2023 Aklivity Inc +# +# Licensed under the Aklivity Community License (the "License"); you may not use +# this file except in compliance with the License. You may obtain a copy of the +# License at +# +# https://www.aklivity.io/aklivity-community-license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# + +connect "zilla://streams/app1" + option zilla:window 8192 + option zilla:transmission "duplex" + +write zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SOURCE IF NOT EXISTS weather (*)\n" + "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" + "INCLUDE timestamp AS timestamp\n" + "INCLUDE header 'zilla:identity' AS owner_id\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +connect "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" + +write zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TOPIC IF NOT EXISTS weather " + "(city VARCHAR, temperature DOUBLE, date DATE);" + [0x00] + +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TOPIC") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt new file mode 100644 index 0000000000..ff8e4dec8c --- /dev/null +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt @@ -0,0 +1,109 @@ +# +# Copyright 2021-2023 Aklivity Inc +# +# Licensed under the Aklivity Community License (the "License"); you may not use +# this file except in compliance with the License. You may obtain a copy of the +# License at +# +# https://www.aklivity.io/aklivity-community-license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# + +accept "zilla://streams/app1" + option zilla:window 8192 + option zilla:transmission "duplex" + +accepted + +read zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +read await CREATE_TOPIC_COMPLETED + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SOURCE IF NOT EXISTS weather (*)\n" + "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" + "INCLUDE timestamp AS timestamp\n" + "INCLUDE header 'zilla:identity' AS owner_id\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + + +accept "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" + +accepted + +read zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TOPIC IF NOT EXISTS weather " + "(city VARCHAR, temperature DOUBLE, date DATE);" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TOPIC") + .build() + .build()} + +write notify CREATE_TOPIC_COMPLETED + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/client.rpt new file mode 100644 index 0000000000..5635455b3c --- /dev/null +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/client.rpt @@ -0,0 +1,100 @@ +# +# Copyright 2021-2023 Aklivity Inc +# +# Licensed under the Aklivity Community License (the "License"); you may not use +# this file except in compliance with the License. You may obtain a copy of the +# License at +# +# https://www.aklivity.io/aklivity-community-license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# + +connect "zilla://streams/app1" + option zilla:window 8192 + option zilla:transmission "duplex" + +write zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE SOURCE IF NOT EXISTS weather (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + +connect "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" + +write zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +write zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +write "CREATE TOPIC IF NOT EXISTS weather " + "(city VARCHAR, temperature DOUBLE, date DATE);" + [0x00] + +write flush + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TOPIC") + .build() + .build()} + +read advised zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/server.rpt new file mode 100644 index 0000000000..52a524dbc4 --- /dev/null +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream/server.rpt @@ -0,0 +1,106 @@ +# +# Copyright 2021-2023 Aklivity Inc +# +# Licensed under the Aklivity Community License (the "License"); you may not use +# this file except in compliance with the License. You may obtain a copy of the +# License at +# +# https://www.aklivity.io/aklivity-community-license/ +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OF ANY KIND, either express or implied. See the License for the +# specific language governing permissions and limitations under the License. +# + +accept "zilla://streams/app1" + option zilla:window 8192 + option zilla:transmission "duplex" + +accepted + +read zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +read await CREATE_TOPIC_COMPLETED + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE SOURCE IF NOT EXISTS weather (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_SOURCE") + .build() + .build()} + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + + +accept "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" + +accepted + +read zilla:begin.ext ${pgsql:beginEx() + .typeId(zilla:id("pgsql")) + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") + .build()} + +connected + +read zilla:data.ext ${pgsql:dataEx() + .typeId(zilla:id("pgsql")) + .query() + .build() + .build()} +read "CREATE TOPIC IF NOT EXISTS weather " + "(city VARCHAR, temperature DOUBLE, date DATE);" + [0x00] + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .completion() + .tag("CREATE_TOPIC") + .build() + .build()} + +write notify CREATE_TOPIC_COMPLETED + +write advise zilla:flush ${pgsql:flushEx() + .typeId(zilla:id("pgsql")) + .ready() + .status("IDLE") + .build() + .build()} + diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/client.rpt similarity index 63% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/client.rpt index 59299d78cc..b277a9e5ba 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/client.rpt @@ -32,17 +32,17 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] +write "CREATE SOURCE IF NOT EXISTS weather_c (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather_c',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -64,39 +64,23 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE MATERIALIZED VIEW weather_view AS SELECT * FROM weather_source;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TABLE weather(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] +write "CREATE SOURCE IF NOT EXISTS weather_f (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather_f',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_SOURCE") .build() .build()} @@ -107,51 +91,35 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_view_sink INTO weather FROM weather_view;" - [0x00] -write flush +connect "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" -read advised zilla:flush ${pgsql:flushEx() +write zilla:begin.ext ${pgsql:beginEx() .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") .build()} -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} +connected write zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() .build() .build()} -write "CREATE SINK weather_sink\n" - "FROM weather\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" +write "CREATE TOPIC IF NOT EXISTS weather_c " + "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] + write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_SINK") + .tag("CREATE_TOPIC") .build() .build()} @@ -162,26 +130,13 @@ read advised zilla:flush ${pgsql:flushEx() .build() .build()} -connect "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -write zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected write zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() .build() .build()} -write "CREATE TOPIC IF NOT EXISTS weather " +write "CREATE TOPIC IF NOT EXISTS weather_f " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] @@ -200,4 +155,3 @@ read advised zilla:flush ${pgsql:flushEx() .status("IDLE") .build() .build()} - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/server.rpt similarity index 68% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/server.rpt index e6d7c47dc1..819f65ae23 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.streams/server.rpt @@ -36,11 +36,11 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" +read "CREATE SOURCE IF NOT EXISTS weather_c (*)\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" + " topic='dev.weather_c',\n" " scan.startup.mode='latest',\n" " scan.startup.timestamp.millis='140000000'\n" ") FORMAT PLAIN ENCODE AVRO (\n" @@ -67,13 +67,22 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE MATERIALIZED VIEW weather_view AS SELECT * FROM weather_source;" +read "CREATE SOURCE IF NOT EXISTS weather_f (*)\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.weather_f',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_MATERIALIZED_VIEW") + .tag("CREATE_SOURCE") .build() .build()} @@ -84,76 +93,41 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TABLE weather(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} +accept "zilla://streams/app2" + option zilla:window 8192 + option zilla:transmission "duplex" -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_view_sink INTO weather FROM weather_view;" - [0x00] +accepted -write advise zilla:flush ${pgsql:flushEx() +read zilla:begin.ext ${pgsql:beginEx() .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() + .parameter("user", "root") + .parameter("database", "dev") + .parameter("application_name", "psql") + .parameter("client_encoding", "UTF8") .build()} -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} +connected read zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() .build() .build()} -read "CREATE SINK weather_sink\n" - "FROM weather\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" +read "CREATE TOPIC IF NOT EXISTS weather_c " + "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_SINK") + .tag("CREATE_TOPIC") .build() .build()} +write notify CREATE_TOPIC_COMPLETED + write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .ready() @@ -161,28 +135,12 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} -accept "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -accepted - -read zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - read zilla:data.ext ${pgsql:dataEx() .typeId(zilla:id("pgsql")) .query() .build() .build()} -read "CREATE TOPIC IF NOT EXISTS weather " +read "CREATE TOPIC IF NOT EXISTS weather_f " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt deleted file mode 100644 index 9e4057d926..0000000000 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/client.rpt +++ /dev/null @@ -1,211 +0,0 @@ -# -# Copyright 2021-2023 Aklivity Inc -# -# Licensed under the Aklivity Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# https://www.aklivity.io/aklivity-community-license/ -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -connect "zilla://streams/app1" - option zilla:window 8192 - option zilla:transmission "duplex" - -write zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" - "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" - "INCLUDE timestamp AS timestamp,\n" - "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE MATERIALIZED VIEW weather_view AS\n" - " SELECT city, temperature, date," - " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," - " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM weather_source;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TABLE weather(" - " city VARCHAR, temperature DOUBLE, date DATE, - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," - " PRIMARY KEY (city, temperature, date));" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_view_sink INTO weather FROM weather_view;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_sink\n" - "FROM weather\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -connect "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -write zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TOPIC IF NOT EXISTS weather" - " (city VARCHAR, temperature DOUBLE, date DATE," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt deleted file mode 100644 index 2ae261fc5d..0000000000 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.includes/server.rpt +++ /dev/null @@ -1,214 +0,0 @@ -# -# Copyright 2021-2023 Aklivity Inc -# -# Licensed under the Aklivity Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# https://www.aklivity.io/aklivity-community-license/ -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -accept "zilla://streams/app1" - option zilla:window 8192 - option zilla:transmission "duplex" - -accepted - -read zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -read await CREATE_TOPIC_COMPLETED - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SOURCE IF NOT EXISTS weather_source (*)\n" - "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" - "INCLUDE timestamp AS timestamp,\n" - "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE MATERIALIZED VIEW weather_view AS\n" - " SELECT city, temperature, date," - " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," - " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM weather_source;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TABLE weather(" - " city VARCHAR, temperature DOUBLE, date DATE, - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," - " PRIMARY KEY (city, temperature, date));" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_view_sink INTO weather FROM weather_view;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_sink\n" - "FROM weather\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - - -accept "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -accepted - -read zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TOPIC IF NOT EXISTS weather" - " (city VARCHAR, temperature DOUBLE, date DATE," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP);" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -write notify CREATE_TOPIC_COMPLETED - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt deleted file mode 100644 index 9b00d908de..0000000000 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/client.rpt +++ /dev/null @@ -1,362 +0,0 @@ -# -# Copyright 2021-2023 Aklivity Inc -# -# Licensed under the Aklivity Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# https://www.aklivity.io/aklivity-community-license/ -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -connect "zilla://streams/app1" - option zilla:window 8192 - option zilla:transmission "duplex" - -write zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SOURCE IF NOT EXISTS weather_c_source (*)\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_c',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE MATERIALIZED VIEW weather_c_view AS SELECT * FROM weather_c_source;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TABLE weather_c(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_c_view_sink INTO weather_c FROM weather_c_view;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_c_sink\n" - "FROM weather_c\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather_c',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SOURCE IF NOT EXISTS weather_f_source (*)\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_f',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE MATERIALIZED VIEW weather_f_view AS SELECT * FROM weather_f_source;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TABLE weather_f(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_f_view_sink INTO weather_f FROM weather_f_view;" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE SINK weather_f_sink\n" - "FROM weather_f\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather_f',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -connect "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -write zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TOPIC IF NOT EXISTS weather_c " - "(city VARCHAR, temperature DOUBLE, date DATE);" - [0x00] - -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -write zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -write "CREATE TOPIC IF NOT EXISTS weather_f " - "(city VARCHAR, temperature DOUBLE, date DATE);" - [0x00] - -write flush - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -read advised zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt deleted file mode 100644 index 12f3dcd7b2..0000000000 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.tables/server.rpt +++ /dev/null @@ -1,357 +0,0 @@ -# -# Copyright 2021-2023 Aklivity Inc -# -# Licensed under the Aklivity Community License (the "License"); you may not use -# this file except in compliance with the License. You may obtain a copy of the -# License at -# -# https://www.aklivity.io/aklivity-community-license/ -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -accept "zilla://streams/app1" - option zilla:window 8192 - option zilla:transmission "duplex" - -accepted - -read zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -read await CREATE_TOPIC_COMPLETED - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SOURCE IF NOT EXISTS weather_c_source (*)\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_c',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE MATERIALIZED VIEW weather_c_view AS SELECT * FROM weather_c_source;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TABLE weather_c(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_c_view_sink INTO weather_c FROM weather_c_view;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_c_sink\n" - "FROM weather_c\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather_c',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SOURCE IF NOT EXISTS weather_f_source (*)\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.weather_f',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SOURCE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE MATERIALIZED VIEW weather_f_view AS SELECT * FROM weather_f_source;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_MATERIALIZED_VIEW") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TABLE weather_f(\n" - "city VARCHAR, temperature DOUBLE, date DATE,\n - "PRIMARY KEY (city, temperature, date));" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TABLE") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_f_view_sink INTO weather_f FROM weather_f_view;" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE SINK weather_f_sink\n" - "FROM weather_f\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.weather_f',\n" - " properties.bootstrap.server='localhost:9092',\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081',\n" - " force_append_only='true'\n" - ");" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_SINK") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - -accept "zilla://streams/app2" - option zilla:window 8192 - option zilla:transmission "duplex" - -accepted - -read zilla:begin.ext ${pgsql:beginEx() - .typeId(zilla:id("pgsql")) - .parameter("user", "root") - .parameter("database", "dev") - .parameter("application_name", "psql") - .parameter("client_encoding", "UTF8") - .build()} - -connected - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TOPIC IF NOT EXISTS weather_c " - "(city VARCHAR, temperature DOUBLE, date DATE);" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -write notify CREATE_TOPIC_COMPLETED - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} - - -read zilla:data.ext ${pgsql:dataEx() - .typeId(zilla:id("pgsql")) - .query() - .build() - .build()} -read "CREATE TOPIC IF NOT EXISTS weather_f " - "(city VARCHAR, temperature DOUBLE, date DATE);" - [0x00] - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .completion() - .tag("CREATE_TOPIC") - .build() - .build()} - -write advise zilla:flush ${pgsql:flushEx() - .typeId(zilla:id("pgsql")) - .ready() - .status("IDLE") - .build() - .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt similarity index 95% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/client.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt index 7529d60a4b..5de31292b9 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt @@ -32,7 +32,7 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS weather " +write "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE)\n" "INCLUDE zilla_correlation_id AS correlation_id\n" "INCLUDE zilla_identity AS owner_id\n" @@ -44,7 +44,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt similarity index 97% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/server.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt index bf70fb8462..fd3f99beec 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt @@ -36,7 +36,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS weather " +read "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE)\n" "INCLUDE zilla_correlation_id AS correlation_id\n" "INCLUDE zilla_identity AS owner_id\n" diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/client.rpt similarity index 94% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/client.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/client.rpt index f13127bff9..245b79577a 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/client.rpt @@ -32,7 +32,7 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS weather " +write "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] @@ -41,7 +41,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt similarity index 97% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/server.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt index 2e2cc77ca9..db7121fb8d 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt @@ -36,7 +36,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS weather " +read "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt similarity index 98% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/client.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt index be9c1b188e..1941c80004 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt @@ -32,7 +32,7 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS weather_c " +write "CREATE STREAM IF NOT EXISTS weather_c " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt similarity index 98% rename from incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/server.rpt rename to incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt index 8ec0dc1570..99b0d55804 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.tables/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt @@ -36,7 +36,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS weather_c " +read "CREATE STREAM IF NOT EXISTS weather_c " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] From fb055ed47202f23e6f467e52b65b7fab655afc46 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 14:33:36 -0700 Subject: [PATCH 06/11] Refactor test name --- .../risingwave/streams/EffectiveIT.java | 18 +++++++++--------- .../binding/risingwave/streams/PgsqlIT.java | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/EffectiveIT.java b/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/EffectiveIT.java index d1b671d511..b2a3a4dff1 100644 --- a/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/EffectiveIT.java +++ b/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/EffectiveIT.java @@ -48,10 +48,10 @@ public void shouldCreateTableWithPrimaryKey() throws Exception @Test @Specification({ - "${app}/create.table/client", - "${app}/create.table/server" + "${app}/create.stream/client", + "${app}/create.stream/server" }) - public void shouldCreateTable() throws Exception + public void shouldCreateStream() throws Exception { k3po.finish(); } @@ -107,9 +107,9 @@ public void shouldCreateFunctionEmbedded() throws Exception @Test @Specification({ - "${app}/create.table.with.includes/client", - "${app}/create.table.with.includes/server" }) - public void shouldCreateTableWithIncludes() throws Exception + "${app}/create.stream.with.includes/client", + "${app}/create.stream.with.includes/server" }) + public void shouldCreateStreamWithIncludes() throws Exception { k3po.finish(); } @@ -134,9 +134,9 @@ public void shouldShowTablesWithNewline() throws Exception @Test @Specification({ - "${app}/create.tables/client", - "${app}/create.tables/server" }) - public void shouldCreateTables() throws Exception + "${app}/create.streams/client", + "${app}/create.streams/server" }) + public void shouldCreateStreams() throws Exception { k3po.finish(); } diff --git a/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/PgsqlIT.java b/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/PgsqlIT.java index 7227533b33..ceb626e751 100644 --- a/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/PgsqlIT.java +++ b/incubator/binding-risingwave.spec/src/test/java/io/aklivity/zilla/specs/binding/risingwave/streams/PgsqlIT.java @@ -48,10 +48,10 @@ public void shouldCreateTableWithPrimaryKey() throws Exception @Test @Specification({ - "${app}/create.table/client", - "${app}/create.table/server" + "${app}/create.stream/client", + "${app}/create.stream/server" }) - public void shouldCreateTable() throws Exception + public void shouldCreateStream() throws Exception { k3po.finish(); } @@ -107,9 +107,9 @@ public void shouldCreateFunctionEmbedded() throws Exception @Test @Specification({ - "${app}/create.table.with.includes/client", - "${app}/create.table.with.includes/server" }) - public void shouldCreateTableWithIncludes() throws Exception + "${app}/create.stream.with.includes/client", + "${app}/create.stream.with.includes/server" }) + public void shouldCreateStreamWithIncludes() throws Exception { k3po.finish(); } @@ -134,8 +134,8 @@ public void shouldShowTablesWithNewline() throws Exception @Test @Specification({ - "${app}/create.tables/client", - "${app}/create.tables/server" }) + "${app}/create.streams/client", + "${app}/create.streams/server" }) public void shouldCreateTables() throws Exception { k3po.finish(); From e40e29173f0d988d8399bff9bd114923751fd2c8 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 15:27:32 -0700 Subject: [PATCH 07/11] Fix typo --- .../streams/pgsql/create.stream.with.includes/server.rpt | 2 +- .../binding/risingwave/streams/pgsql/create.stream/server.rpt | 2 +- .../risingwave/streams/pgsql/create.streams/client.rpt | 4 ++-- .../risingwave/streams/pgsql/create.streams/server.rpt | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt index fd3f99beec..9bcd89d214 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt @@ -46,7 +46,7 @@ read "CREATE STREAM IF NOT EXISTS weather " write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt index db7121fb8d..45dc55a0b7 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream/server.rpt @@ -43,7 +43,7 @@ read "CREATE STREAM IF NOT EXISTS weather " write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt index 1941c80004..71aef7c9c5 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt @@ -41,7 +41,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} @@ -66,7 +66,7 @@ write flush read advised zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt index 99b0d55804..885259e4ad 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt @@ -43,7 +43,7 @@ read "CREATE STREAM IF NOT EXISTS weather_c " write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} @@ -61,7 +61,7 @@ read "CREATE TABLE IF NOT EXISTS weather_f " write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) .completion() - .tag("CREATE_TABLE") + .tag("CREATE_STREAM") .build() .build()} From b31bfeb97200f28558e0d62bf389bc466efc1d2d Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 15:44:50 -0700 Subject: [PATCH 08/11] Checkpoint CREATE STREAM --- .../config/RisingwaveCommandType.java | 1 + .../statement/RisingwaveCommandTemplate.java | 1 + .../statement/RisingwaveSqlCommandParser.java | 2 +- .../stream/RisingwaveCompletionCommand.java | 1 + .../stream/RisingwaveProxyFactory.java | 42 +++++++++++++++++++ .../risingwave/internal/stream/ProxyIT.java | 18 ++++---- 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveCommandType.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveCommandType.java index c0a0409270..1c16bea36e 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveCommandType.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveCommandType.java @@ -20,6 +20,7 @@ public enum RisingwaveCommandType { CREATE_TOPIC_COMMAND("CREATE TOPIC".getBytes()), CREATE_TABLE_COMMAND("CREATE TABLE".getBytes()), + CREATE_STREAM_COMMAND("CREATE STREAM".getBytes()), CREATE_MATERIALIZED_VIEW_COMMAND("CREATE MATERIALIZED VIEW".getBytes()), CREATE_FUNCTION_COMMAND("CREATE FUNCTION".getBytes()), UNKNOWN_COMMAND("UNKNOWN".getBytes()); diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java index d97fb34c48..ea64b61e3f 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java @@ -70,6 +70,7 @@ public RisingwaveCreateTableCommand parserCreateTable( int length) { String query = buffer.getStringWithoutLengthUtf8(offset, length); + query = query.replaceAll("(?i)STREAM", "TABLE"); int includeIndex = query.indexOf("INCLUDE"); diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveSqlCommandParser.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveSqlCommandParser.java index 619a25ddfb..5fe8d3a60b 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveSqlCommandParser.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveSqlCommandParser.java @@ -27,7 +27,7 @@ public final class RisingwaveSqlCommandParser private static final String SQL_COMMAND_PATTERN = "(?i)\\b(CREATE FUNCTION)\\b.*?\\$\\$(.*?)\\$\\$\\s*;[\\x00\\n]*" + "|\\b(CREATE FUNCTION)\\b.*?RETURNS .*?AS.*?;[\\x00\\n]*" + - "|\\b(CREATE MATERIALIZED VIEW|CREATE SOURCE|CREATE SINK|CREATE INDEX" + + "|\\b(CREATE MATERIALIZED VIEW|CREATE SOURCE|CREATE SINK|CREATE INDEX|CREATE STREAM" + "|CREATE VIEW|SHOW TABLES|DESCRIBE|SHOW)\\b.*?;[\\x00\\n]*" + "|\\b(SELECT|INSERT|UPDATE|DELETE|ALTER|DROP|CREATE TABLE|CREATE SCHEMA|CREATE DATABASE)\\b.*?;[\\x00\\n]*"; diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveCompletionCommand.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveCompletionCommand.java index b80098e3e8..5c3204e749 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveCompletionCommand.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveCompletionCommand.java @@ -19,6 +19,7 @@ public enum RisingwaveCompletionCommand UNKNOWN_COMMAND("UNKNOWN".getBytes()), CREATE_TABLE_COMMAND("CREATE_TABLE".getBytes()), CREATE_MATERIALIZED_VIEW_COMMAND("CREATE_MATERIALIZED_VIEW".getBytes()), + CREATE_STREAM_COMMAND("CREATE_STREAM".getBytes()), CREATE_FUNCTION_COMMAND("CREATE_FUNCTION".getBytes()); private final byte[] value; diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java index 418a848edd..a53ca86eb4 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java @@ -144,6 +144,7 @@ public final class RisingwaveProxyFactory implements RisingwaveStreamFactory Object2ObjectHashMap clientTransforms = new Object2ObjectHashMap<>(); clientTransforms.put(RisingwaveCommandType.CREATE_TABLE_COMMAND, this::decodeCreateTableCommand); + clientTransforms.put(RisingwaveCommandType.CREATE_STREAM_COMMAND, this::decodeCreateStreamCommand); clientTransforms.put(RisingwaveCommandType.CREATE_MATERIALIZED_VIEW_COMMAND, this::decodeCreateMaterializedViewCommand); clientTransforms.put(RisingwaveCommandType.CREATE_FUNCTION_COMMAND, this::decodeCreateFunctionCommand); clientTransforms.put(RisingwaveCommandType.UNKNOWN_COMMAND, this::decodeUnknownCommand); @@ -1504,6 +1505,47 @@ else if (server.commandsProcessed == 1) } } + private void decodeCreateStreamCommand( + PgsqlServer server, + long traceId, + long authorization, + DirectBuffer buffer, + int offset, + int length) + { + if (server.commandsProcessed == 2) + { + server.onCommandCompleted(traceId, authorization, length, RisingwaveCompletionCommand.CREATE_STREAM_COMMAND); + } + else + { + final RisingwaveBindingConfig binding = server.binding; + final RisingwaveCreateTableCommand command = binding.createTable.parserCreateTable(buffer, offset, length); + + String newStatement = ""; + int progress = 0; + + if (server.commandsProcessed == 0) + { + newStatement = binding.createTopic.generate(command.createTable); + } + else if (server.commandsProcessed == 1) + { + newStatement = binding.createSource.generate(server.database, command); + } + + statementBuffer.putBytes(progress, newStatement.getBytes()); + progress += newStatement.length(); + + final RisingwaveRouteConfig route = + server.binding.resolve(authorization, statementBuffer, 0, progress); + + final PgsqlClient client = server.streamsByRouteIds.get(route.id); + client.doPgsqlQuery(traceId, authorization, statementBuffer, 0, progress); + client.typeCommand = ignoreFlushCommand; + } + } + private void decodeCreateMaterializedViewCommand( PgsqlServer server, long traceId, diff --git a/incubator/binding-risingwave/src/test/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/ProxyIT.java b/incubator/binding-risingwave/src/test/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/ProxyIT.java index 316ab6d996..9eed51a8c0 100644 --- a/incubator/binding-risingwave/src/test/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/ProxyIT.java +++ b/incubator/binding-risingwave/src/test/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/ProxyIT.java @@ -62,9 +62,9 @@ public void shouldCreateTableWithPrimaryKey() throws Exception @Test @Configuration("proxy.yaml") @Specification({ - "${pgsql}/create.table/client", - "${effective}/create.table/server" }) - public void shouldCreateTable() throws Exception + "${pgsql}/create.stream/client", + "${effective}/create.stream/server" }) + public void shouldCreateStream() throws Exception { k3po.finish(); } @@ -72,9 +72,9 @@ public void shouldCreateTable() throws Exception @Test @Configuration("proxy.yaml") @Specification({ - "${pgsql}/create.tables/client", - "${effective}/create.tables/server" }) - public void shouldCreateTables() throws Exception + "${pgsql}/create.streams/client", + "${effective}/create.streams/server" }) + public void shouldCreateStreams() throws Exception { k3po.finish(); } @@ -144,9 +144,9 @@ public void shouldCreateFunctionEmbedded() throws Exception @Test @Configuration("proxy.yaml") @Specification({ - "${pgsql}/create.table.with.includes/client", - "${effective}/create.table.with.includes/server" }) - public void shouldCreateTableWithIncludes() throws Exception + "${pgsql}/create.stream.with.includes/client", + "${effective}/create.stream.with.includes/server" }) + public void shouldCreateStreamWithIncludes() throws Exception { k3po.finish(); } From c50840b3829ddd09b1fb2571ff5b1609e280d1a4 Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Wed, 2 Oct 2024 16:41:12 -0700 Subject: [PATCH 09/11] WIP --- .../create.table.with.primary.key/client.rpt | 18 +++---- .../create.table.with.primary.key/server.rpt | 24 ++++----- .../query.with.multiple.statements/client.rpt | 18 +++---- .../query.with.multiple.statements/server.rpt | 24 ++++----- .../streams/pgsql/create.streams/client.rpt | 2 +- .../streams/pgsql/create.streams/server.rpt | 2 +- .../config/RisingwaveBindingConfig.java | 3 +- ...ingwaveCreateMaterializedViewTemplate.java | 14 +++-- .../RisingwaveCreateSinkTemplate.java | 28 ++++++++-- .../RisingwaveCreateSourceTemplate.java | 11 +++- .../RisingwaveCreateTableTemplate.java | 53 +++++-------------- .../stream/RisingwaveProxyFactory.java | 22 ++++++-- 12 files changed, 121 insertions(+), 98 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt index f8711e888e..b5829feab7 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/client.rpt @@ -64,8 +64,8 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" - [0x00] +write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -137,14 +137,14 @@ write zilla:data.ext ${pgsql:dataEx() write "CREATE SINK cities_sink\n" "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt index 446eec99c9..11d987ffc1 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key/server.rpt @@ -67,7 +67,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" +read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;" [0x00] write advise zilla:flush ${pgsql:flushEx() @@ -134,17 +134,17 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SINK cities_sink\n" - "FROM cities\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n - ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] +read "CREATE SINK cities_sink\n" + "FROM cities\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" + [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt index 7c5bfb18d9..98a4b465ce 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/client.rpt @@ -64,8 +64,8 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" - [0x00] +write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -137,14 +137,14 @@ write zilla:data.ext ${pgsql:dataEx() write "CREATE SINK cities_sink\n" "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt index 42ed80dd3b..b3378e42e4 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/query.with.multiple.statements/server.rpt @@ -67,7 +67,7 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE MATERIALIZED VIEW cities_view AS SELECT * FROM cities_source;" +read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS SELECT * FROM cities_source;" [0x00] write advise zilla:flush ${pgsql:flushEx() @@ -134,17 +134,17 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE SINK cities_sink\n" - "FROM cities\n" - "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n - ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] +read "CREATE SINK cities_sink\n" + "FROM cities\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" + ") FORMAT UPSERT ENCODE AVRO (\n" + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" + [0x00] write advise zilla:flush ${pgsql:flushEx() .typeId(zilla:id("pgsql")) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt index 71aef7c9c5..044b7660a5 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/client.rpt @@ -57,7 +57,7 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS weather_f " +write "CREATE STREAM IF NOT EXISTS weather_f " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt index 885259e4ad..f852dbdb84 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.streams/server.rpt @@ -54,7 +54,7 @@ write advise zilla:flush ${pgsql:flushEx() .build() .build()} -read "CREATE TABLE IF NOT EXISTS weather_f " +read "CREATE STREAM IF NOT EXISTS weather_f " "(city VARCHAR, temperature DOUBLE, date DATE);" [0x00] diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveBindingConfig.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveBindingConfig.java index 602e124808..20431d5e40 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveBindingConfig.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/config/RisingwaveBindingConfig.java @@ -81,8 +81,7 @@ public RisingwaveBindingConfig( udf = options.udfs.get(0); } - this.createTable = new RisingwaveCreateTableTemplate(bootstrapServer, - location, config.kafkaScanStartupTimestampMillis()); + this.createTable = new RisingwaveCreateTableTemplate(); this.createSource = new RisingwaveCreateSourceTemplate(bootstrapServer, location, config.kafkaScanStartupTimestampMillis()); this.createSink = new RisingwaveCreateSinkTemplate(bootstrapServer, location); diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java index 17c227df3a..1235617d30 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java @@ -14,7 +14,7 @@ */ package io.aklivity.zilla.runtime.binding.risingwave.internal.statement; -import net.sf.jsqlparser.statement.Statement; +import net.sf.jsqlparser.statement.create.table.CreateTable; import net.sf.jsqlparser.statement.create.view.CreateView; public class RisingwaveCreateMaterializedViewTemplate extends RisingwaveCommandTemplate @@ -27,12 +27,20 @@ public RisingwaveCreateMaterializedViewTemplate() } public String generate( - Statement statement) + CreateView createView) { - CreateView createView = (CreateView) statement; String view = createView.getView().getName(); String select = createView.getSelect().toString(); return String.format(sqlFormat, view, select); } + + public String generate( + RisingwaveCreateTableCommand command) + { + CreateTable createTable = command.createTable; + String name = createTable.getTable().getName(); + + return String.format(sqlFormat, "%s_view".formatted(name), "SELECT * FROM %s_source".formatted(name)); + } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSinkTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSinkTemplate.java index d5133d2eaf..e30a55b5f3 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSinkTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSinkTemplate.java @@ -17,12 +17,14 @@ import java.util.Map; import java.util.Optional; -import net.sf.jsqlparser.statement.Statement; +import net.sf.jsqlparser.statement.create.table.CreateTable; import net.sf.jsqlparser.statement.create.view.CreateView; public class RisingwaveCreateSinkTemplate extends RisingwaveCommandTemplate { private final String sqlFormat = """ + CREATE SINK %s_view_sink INTO %s FROM %s_view;\u0000"""; + private final String sqlKafkaFormat = """ CREATE SINK %s_sink FROM %s WITH ( @@ -49,9 +51,8 @@ public RisingwaveCreateSinkTemplate( public String generate( String database, Map columns, - Statement statement) + CreateView createView) { - CreateView createView = (CreateView) statement; String viewName = createView.getView().getName(); Optional> primaryKeyMatch = columns.entrySet().stream() @@ -68,6 +69,25 @@ public String generate( String textPrimaryKey = primaryKeyMatch.map(Map.Entry::getKey).orElse(null); String primaryKey = textPrimaryKey != null ? primaryKeyFormat.formatted(textPrimaryKey) : ""; - return String.format(sqlFormat, viewName, viewName, bootstrapServer, database, viewName, primaryKey, schemaRegistry); + return String.format(sqlKafkaFormat, viewName, viewName, bootstrapServer, database, viewName, primaryKey, schemaRegistry); + } + + public String generate( + String database, + String primaryKey, + CreateTable createTable) + { + String table = createTable.getTable().getName(); + + return String.format(sqlKafkaFormat, table, table, bootstrapServer, database, table, + primaryKeyFormat.formatted(primaryKey), schemaRegistry); + } + + public String generate( + CreateTable createTable) + { + String table = createTable.getTable().getName(); + + return String.format(sqlFormat, table, table, table); } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java index da095da905..a6c729de57 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java @@ -47,8 +47,17 @@ public RisingwaveCreateSourceTemplate( public String generate( String database, RisingwaveCreateTableCommand command) + { + return generate(database, "", command); + } + + public String generate( + String database, + String prefix, + RisingwaveCreateTableCommand command) { String table = command.createTable.getTable().getName(); + String sourceName = "%s%s".formatted(table, prefix); includeBuilder.setLength(0); final Map includes = command.includes; @@ -59,6 +68,6 @@ public String generate( includeBuilder.delete(includeBuilder.length() - 1, includeBuilder.length()); } - return String.format(sqlFormat, table, includeBuilder, bootstrapServer, database, table, scanStartupMil, schemaRegistry); + return String.format(sqlFormat, sourceName, includeBuilder, bootstrapServer, database, table, scanStartupMil, schemaRegistry); } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java index ac4d8507dc..7c6e275b04 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java @@ -14,61 +14,36 @@ */ package io.aklivity.zilla.runtime.binding.risingwave.internal.statement; -import java.util.Map; - import net.sf.jsqlparser.statement.create.table.CreateTable; public class RisingwaveCreateTableTemplate extends RisingwaveCommandTemplate { private final String sqlFormat = """ - CREATE TABLE IF NOT EXISTS %s ( - *, - PRIMARY KEY (%s) - ) - INCLUDE KEY AS key%s - WITH ( - connector='kafka', - properties.bootstrap.server='%s', - topic='%s.%s', - scan.startup.mode='latest', - scan.startup.timestamp.millis='%d' - ) FORMAT PLAIN ENCODE AVRO ( - schema.registry = '%s' - );\u0000"""; + CREATE TABLE IF NOT EXISTS %s (%s%s);\u0000"""; + private final String primaryKeyFormat = ", PRIMARY KEY (%s)"; + private final String fieldFormat = "%s %s, "; - private final String bootstrapServer; - private final String schemaRegistry; - private final long scanStartupMil; + private final StringBuilder fieldBuilder = new StringBuilder(); - public RisingwaveCreateTableTemplate( - String bootstrapServer, - String schemaRegistry, - long scanStartupMil) + public RisingwaveCreateTableTemplate() { - this.bootstrapServer = bootstrapServer; - this.schemaRegistry = schemaRegistry; - this.scanStartupMil = scanStartupMil; } public String generate( - String database, RisingwaveCreateTableCommand command) { CreateTable createTable = command.createTable; - String table = createTable.getTable().getName(); + String topic = createTable.getTable().getName(); + String primaryKeyField = primaryKey(createTable); + String primaryKey = primaryKeyField != null ? String.format(primaryKeyFormat, primaryKeyField) : ""; - String primaryKey = primaryKey(createTable); + fieldBuilder.setLength(0); - includeBuilder.setLength(0); - final Map includes = command.includes; - if (includes != null && !includes.isEmpty()) - { - includeBuilder.append("\n"); - includes.forEach((k, v) -> includeBuilder.append(String.format(ZILLA_MAPPINGS.get(k), v))); - includeBuilder.delete(includeBuilder.length() - 1, includeBuilder.length()); - } + createTable.getColumnDefinitions() + .forEach(c -> fieldBuilder.append( + String.format(fieldFormat, c.getColumnName(), c.getColDataType().getDataType()))); + fieldBuilder.delete(fieldBuilder.length() - 2, fieldBuilder.length()); - return String.format(sqlFormat, table, primaryKey, includeBuilder, bootstrapServer, database, - table, scanStartupMil, schemaRegistry); + return String.format(sqlFormat, topic, fieldBuilder, primaryKey); } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java index a53ca86eb4..86cfc7913b 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java @@ -1467,7 +1467,7 @@ private void decodeCreateTableCommand( int offset, int length) { - if (server.commandsProcessed == 2) + if (server.commandsProcessed == 6) { server.onCommandCompleted(traceId, authorization, length, RisingwaveCompletionCommand.CREATE_TABLE_COMMAND); } @@ -1484,13 +1484,25 @@ private void decodeCreateTableCommand( { newStatement = binding.createTopic.generate(command.createTable); } - else if (server.commandsProcessed == 1 && primaryKey != null) + else if (server.commandsProcessed == 1) { - newStatement = binding.createTable.generate(server.database, command); + newStatement = binding.createSource.generate(server.database, "_source", command); } - else if (server.commandsProcessed == 1) + else if (server.commandsProcessed == 2) { - newStatement = binding.createSource.generate(server.database, command); + newStatement = binding.createView.generate(command); + } + else if (server.commandsProcessed == 3) + { + newStatement = binding.createTable.generate(command); + } + else if (server.commandsProcessed == 4) + { + newStatement = binding.createSink.generate(command.createTable); + } + else if (server.commandsProcessed == 5) + { + newStatement = binding.createSink.generate(server.database, primaryKey, command.createTable); } statementBuffer.putBytes(progress, newStatement.getBytes()); From 42ea5ad4d5dce025b55ac955b37d8f757ea0cebe Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Thu, 3 Oct 2024 12:23:35 -0700 Subject: [PATCH 10/11] Checkpoint --- .../create.stream.with.includes/client.rpt | 2 +- .../create.stream.with.includes/server.rpt | 2 +- .../client.rpt | 62 +++++++++---------- .../server.rpt | 37 +++++------ .../create.stream.with.includes/client.rpt | 2 +- .../create.stream.with.includes/server.rpt | 2 +- .../client.rpt | 2 +- .../server.rpt | 2 +- .../statement/RisingwaveCommandTemplate.java | 13 +++- ...ingwaveCreateMaterializedViewTemplate.java | 29 ++++++++- .../RisingwaveCreateSourceTemplate.java | 36 ++++++++--- .../RisingwaveCreateTableTemplate.java | 9 ++- .../RisingwaveCreateTopicTemplate.java | 26 ++++++++ .../stream/RisingwaveProxyFactory.java | 6 +- 14 files changed, 160 insertions(+), 70 deletions(-) diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt index 10aa0d39ab..679a78508e 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/client.rpt @@ -34,8 +34,8 @@ write zilla:data.ext ${pgsql:dataEx() .build()} write "CREATE SOURCE IF NOT EXISTS weather (*)\n" "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" + "INCLUDE header 'zilla:identity' AS identity\n" "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt index ff8e4dec8c..9871eea900 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.stream.with.includes/server.rpt @@ -38,8 +38,8 @@ read zilla:data.ext ${pgsql:dataEx() .build()} read "CREATE SOURCE IF NOT EXISTS weather (*)\n" "INCLUDE header 'zilla:correlation-id' AS correlation_id\n" + "INCLUDE header 'zilla:identity' AS identity\n" "INCLUDE timestamp AS timestamp\n" - "INCLUDE header 'zilla:identity' AS owner_id\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt index 08fe7d1347..7c587a897b 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/client.rpt @@ -32,20 +32,20 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" - "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" - "INCLUDE timestamp AS timestamp,\n" - "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" - "WITH (\n" - " connector='kafka',\n" - " properties.bootstrap.server='localhost:9092',\n" - " topic='dev.cities',\n" - " scan.startup.mode='latest',\n" - " scan.startup.timestamp.millis='140000000'\n" - ") FORMAT PLAIN ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" - [0x00] +write "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header\n" + "INCLUDE timestamp AS timestamp\n" + "WITH (\n" + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " scan.startup.mode='latest',\n" + " scan.startup.timestamp.millis='140000000'\n" + ") FORMAT PLAIN ENCODE AVRO (\n" + " schema.registry = 'http://localhost:8081'\n" + ");" + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -67,11 +67,12 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE MATERIALIZED VIEW cities_view AS\n" - " SELECT id, name, description," - " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," - " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM cities_source;" +write "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS" + " SELECT id, name, description," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity," + " timestamp" + " FROM cities_source;" [0x00] write flush @@ -94,9 +95,9 @@ write zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -write "CREATE TABLE IF NOT EXISTS cities " - "(id VARCHAR, name VARCHAR, description VARCHAR," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," +write "CREATE TABLE IF NOT EXISTS cities" + " (id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (id));" [0x00] write flush @@ -121,7 +122,7 @@ write zilla:data.ext ${pgsql:dataEx() .build() .build()} write "CREATE SINK cities_view_sink INTO cities FROM cities_view;" - [0x00] + [0x00] write flush read advised zilla:flush ${pgsql:flushEx() @@ -146,13 +147,13 @@ write zilla:data.ext ${pgsql:dataEx() write "CREATE SINK cities_sink\n" "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" [0x00] write flush @@ -191,7 +192,7 @@ write zilla:data.ext ${pgsql:dataEx() .build()} write "CREATE TOPIC IF NOT EXISTS cities " "(id VARCHAR, name VARCHAR, description VARCHAR," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " correlation_id VARCHAR, identity VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (id));" [0x00] write flush @@ -209,4 +210,3 @@ read advised zilla:flush ${pgsql:flushEx() .status("IDLE") .build() .build()} - diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt index 61a0b16828..4bc34b76a3 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/effective/create.table.with.primary.key.and.includes/server.rpt @@ -37,9 +37,9 @@ read zilla:data.ext ${pgsql:dataEx() .build() .build()} read "CREATE SOURCE IF NOT EXISTS cities_source (*)\n" - "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header,\n" - "INCLUDE timestamp AS timestamp,\n" - "INCLUDE header 'zilla:identity' AS zilla_identity_header,\n" + "INCLUDE header 'zilla:correlation-id' AS zilla_correlation_id_header\n" + "INCLUDE header 'zilla:identity' AS zilla_identity_header\n" + "INCLUDE timestamp AS timestamp\n" "WITH (\n" " connector='kafka',\n" " properties.bootstrap.server='localhost:9092',\n" @@ -70,11 +70,12 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE MATERIALIZED VIEW cities_view AS\n" - " SELECT id, name, description," - " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," - " COALESCE(identity, zilla_identity_header::varchar) as identity, - " timestamp FROM cities_source;" +read "CREATE MATERIALIZED VIEW IF NOT EXISTS cities_view AS" + " SELECT id, name, description," + " COALESCE(correlation_id, zilla_correlation_id_header::varchar) as correlation_id," + " COALESCE(identity, zilla_identity_header::varchar) as identity," + " timestamp" + " FROM cities_source;" [0x00] write advise zilla:flush ${pgsql:flushEx() @@ -96,9 +97,9 @@ read zilla:data.ext ${pgsql:dataEx() .query() .build() .build()} -read "CREATE TABLE IF NOT EXISTS cities " - "(id VARCHAR, name VARCHAR, description VARCHAR," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," +read "CREATE TABLE IF NOT EXISTS cities" + " (id VARCHAR, name VARCHAR, description VARCHAR," + " correlation_id VARCHAR, identity VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (id));" [0x00] @@ -146,13 +147,13 @@ read zilla:data.ext ${pgsql:dataEx() read "CREATE SINK cities_sink\n" "FROM cities\n" "WITH (\n" - " connector='kafka',\n" - " topic='dev.cities',\n" - " properties.bootstrap.server='localhost:9092',\n" - " primary_key='id'\n + " connector='kafka',\n" + " properties.bootstrap.server='localhost:9092',\n" + " topic='dev.cities',\n" + " primary_key='id'\n" ") FORMAT UPSERT ENCODE AVRO (\n" - " schema.registry = 'http://localhost:8081'\n" - ");" + " schema.registry='http://localhost:8081'\n" + ") KEY ENCODE TEXT;" [0x00] write advise zilla:flush ${pgsql:flushEx() @@ -192,7 +193,7 @@ read zilla:data.ext ${pgsql:dataEx() .build()} read "CREATE TOPIC IF NOT EXISTS cities " "(id VARCHAR, name VARCHAR, description VARCHAR," - " correlation_id VARCHAR, identity as VARCHAR, timestamp TIMESTAMP," + " correlation_id VARCHAR, identity VARCHAR, timestamp TIMESTAMP," " PRIMARY KEY (id));" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt index 5de31292b9..dbb1c245b7 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/client.rpt @@ -35,7 +35,7 @@ write zilla:data.ext ${pgsql:dataEx() write "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE)\n" "INCLUDE zilla_correlation_id AS correlation_id\n" - "INCLUDE zilla_identity AS owner_id\n" + "INCLUDE zilla_identity AS identity\n" "INCLUDE timestamp as timestamp;" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt index 9bcd89d214..19833142cf 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.stream.with.includes/server.rpt @@ -39,7 +39,7 @@ read zilla:data.ext ${pgsql:dataEx() read "CREATE STREAM IF NOT EXISTS weather " "(city VARCHAR, temperature DOUBLE, date DATE)\n" "INCLUDE zilla_correlation_id AS correlation_id\n" - "INCLUDE zilla_identity AS owner_id\n" + "INCLUDE zilla_identity AS identity\n" "INCLUDE timestamp as timestamp;" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/client.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/client.rpt index d7aab69d57..f40e1041f9 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/client.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/client.rpt @@ -35,7 +35,7 @@ write zilla:data.ext ${pgsql:dataEx() write "CREATE TABLE IF NOT EXISTS cities " "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id))\n" "INCLUDE zilla_correlation_id AS correlation_id\n" - "INCLUDE zilla_identity AS owner_id\n" + "INCLUDE zilla_identity AS identity\n" "INCLUDE timestamp as timestamp;" [0x00] diff --git a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/server.rpt b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/server.rpt index 1b3abad6af..ed5fda502c 100644 --- a/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/server.rpt +++ b/incubator/binding-risingwave.spec/src/main/scripts/io/aklivity/zilla/specs/binding/risingwave/streams/pgsql/create.table.with.primary.key.and.includes/server.rpt @@ -39,7 +39,7 @@ read zilla:data.ext ${pgsql:dataEx() read "CREATE TABLE IF NOT EXISTS cities " "(id VARCHAR, name VARCHAR, description VARCHAR, PRIMARY KEY (id))\n" "INCLUDE zilla_correlation_id AS correlation_id\n" - "INCLUDE zilla_identity AS owner_id\n" + "INCLUDE zilla_identity AS identity\n" "INCLUDE timestamp as timestamp;" [0x00] diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java index ea64b61e3f..aeb2e088cb 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java @@ -15,6 +15,7 @@ package io.aklivity.zilla.runtime.binding.risingwave.internal.statement; import java.io.StringReader; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -28,11 +29,11 @@ public abstract class RisingwaveCommandTemplate { private final CCJSqlParserManager parserManager = new CCJSqlParserManager(); - private final Map includeMap = new Object2ObjectHashMap<>(); + private final Map includeMap = new LinkedHashMap<>(); + protected final StringBuilder fieldBuilder = new StringBuilder(); protected final StringBuilder includeBuilder = new StringBuilder(); protected static final Map ZILLA_MAPPINGS = new Object2ObjectHashMap<>(); - static { ZILLA_MAPPINGS.put("zilla_correlation_id", "INCLUDE header 'zilla:correlation-id' AS %s\n"); @@ -40,6 +41,14 @@ public abstract class RisingwaveCommandTemplate ZILLA_MAPPINGS.put("timestamp", "INCLUDE timestamp AS %s\n"); } + protected static final Map ZILLA_INCLUDE_TYPE_MAPPINGS = new Object2ObjectHashMap<>(); + static + { + ZILLA_INCLUDE_TYPE_MAPPINGS.put("zilla_correlation_id", "VARCHAR"); + ZILLA_INCLUDE_TYPE_MAPPINGS.put("zilla_identity", "VARCHAR"); + ZILLA_INCLUDE_TYPE_MAPPINGS.put("timestamp", "TIMESTAMP"); + } + public String primaryKey( CreateTable statement) { diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java index 1235617d30..4a57891eb3 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateMaterializedViewTemplate.java @@ -21,6 +21,8 @@ public class RisingwaveCreateMaterializedViewTemplate extends RisingwaveCommandT { private final String sqlFormat = """ CREATE MATERIALIZED VIEW IF NOT EXISTS %s AS %s;\u0000"""; + private final String fieldFormat = "%s, "; + private final String includeFormat = "COALESCE(%s, zilla_%s_header::varchar) as %s, "; public RisingwaveCreateMaterializedViewTemplate() { @@ -41,6 +43,31 @@ public String generate( CreateTable createTable = command.createTable; String name = createTable.getTable().getName(); - return String.format(sqlFormat, "%s_view".formatted(name), "SELECT * FROM %s_source".formatted(name)); + String select = "*"; + + if (command.includes != null) + { + fieldBuilder.setLength(0); + + createTable.getColumnDefinitions() + .forEach(c -> fieldBuilder.append( + String.format(fieldFormat, c.getColumnName()))); + command.includes.forEach((k, v) -> + { + if ("timestamp".equals(k)) + { + fieldBuilder.append(String.format(fieldFormat, v)); + } + else + { + fieldBuilder.append(String.format(includeFormat, v, v, v)); + } + }); + + fieldBuilder.delete(fieldBuilder.length() - 2, fieldBuilder.length()); + select = fieldBuilder.toString(); + } + + return String.format(sqlFormat, "%s_view".formatted(name), "SELECT %s FROM %s_source".formatted(select, name)); } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java index a6c729de57..1e64e8456d 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateSourceTemplate.java @@ -44,30 +44,52 @@ public RisingwaveCreateSourceTemplate( this.scanStartupMil = scanStartupMil; } - public String generate( + public String generateStreamSource( String database, RisingwaveCreateTableCommand command) { - return generate(database, "", command); + String table = command.createTable.getTable().getName(); + + includeBuilder.setLength(0); + final Map includes = command.includes; + if (includes != null && !includes.isEmpty()) + { + includeBuilder.append("\n"); + includes.forEach((k, v) -> includeBuilder.append(String.format(ZILLA_MAPPINGS.get(k), v))); + includeBuilder.delete(includeBuilder.length() - 1, includeBuilder.length()); + } + + return String.format(sqlFormat, table, includeBuilder, bootstrapServer, database, table, scanStartupMil, schemaRegistry); } - public String generate( + public String generateTableSource( String database, - String prefix, RisingwaveCreateTableCommand command) { String table = command.createTable.getTable().getName(); - String sourceName = "%s%s".formatted(table, prefix); + String sourceName = "%s_source".formatted(table); includeBuilder.setLength(0); final Map includes = command.includes; if (includes != null && !includes.isEmpty()) { includeBuilder.append("\n"); - includes.forEach((k, v) -> includeBuilder.append(String.format(ZILLA_MAPPINGS.get(k), v))); + includes.forEach((k, v) -> + { + if ("timestamp".equals(k)) + { + includeBuilder.append(String.format(ZILLA_MAPPINGS.get(k), v)); + } + else + { + includeBuilder.append(String.format(ZILLA_MAPPINGS.get(k), "zilla_%s_header".formatted(v))); + } + + }); includeBuilder.delete(includeBuilder.length() - 1, includeBuilder.length()); } - return String.format(sqlFormat, sourceName, includeBuilder, bootstrapServer, database, table, scanStartupMil, schemaRegistry); + return String.format(sqlFormat, sourceName, includeBuilder, bootstrapServer, + database, table, scanStartupMil, schemaRegistry); } } diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java index 7c6e275b04..9e8f98acf0 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTableTemplate.java @@ -23,8 +23,6 @@ public class RisingwaveCreateTableTemplate extends RisingwaveCommandTemplate private final String primaryKeyFormat = ", PRIMARY KEY (%s)"; private final String fieldFormat = "%s %s, "; - private final StringBuilder fieldBuilder = new StringBuilder(); - public RisingwaveCreateTableTemplate() { } @@ -42,6 +40,13 @@ public String generate( createTable.getColumnDefinitions() .forEach(c -> fieldBuilder.append( String.format(fieldFormat, c.getColumnName(), c.getColDataType().getDataType()))); + + if (command.includes != null) + { + command.includes.forEach((k, v) -> fieldBuilder.append( + String.format(fieldFormat, v, ZILLA_INCLUDE_TYPE_MAPPINGS.get(k)))); + } + fieldBuilder.delete(fieldBuilder.length() - 2, fieldBuilder.length()); return String.format(sqlFormat, topic, fieldBuilder, primaryKey); diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTopicTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTopicTemplate.java index 9e2c627c56..f088a3111a 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTopicTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCreateTopicTemplate.java @@ -45,6 +45,32 @@ public String generate( createTable.getColumnDefinitions() .forEach(c -> fieldBuilder.append( String.format(fieldFormat, c.getColumnName(), c.getColDataType().getDataType()))); + + fieldBuilder.delete(fieldBuilder.length() - 2, fieldBuilder.length()); + + return String.format(sqlFormat, topic, fieldBuilder, primaryKey); + } + + public String generate( + RisingwaveCreateTableCommand command) + { + CreateTable createTable = command.createTable; + String topic = createTable.getTable().getName(); + String primaryKeyField = primaryKey(createTable); + String primaryKey = primaryKeyField != null ? String.format(primaryKeyFormat, primaryKeyField) : ""; + + fieldBuilder.setLength(0); + + createTable.getColumnDefinitions() + .forEach(c -> fieldBuilder.append( + String.format(fieldFormat, c.getColumnName(), c.getColDataType().getDataType()))); + + if (command.includes != null) + { + command.includes.forEach((k, v) -> fieldBuilder.append( + String.format(fieldFormat, v, ZILLA_INCLUDE_TYPE_MAPPINGS.get(k)))); + } + fieldBuilder.delete(fieldBuilder.length() - 2, fieldBuilder.length()); return String.format(sqlFormat, topic, fieldBuilder, primaryKey); diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java index 86cfc7913b..a4e1a31aee 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/stream/RisingwaveProxyFactory.java @@ -1482,11 +1482,11 @@ private void decodeCreateTableCommand( if (server.commandsProcessed == 0) { - newStatement = binding.createTopic.generate(command.createTable); + newStatement = binding.createTopic.generate(command); } else if (server.commandsProcessed == 1) { - newStatement = binding.createSource.generate(server.database, "_source", command); + newStatement = binding.createSource.generateTableSource(server.database, command); } else if (server.commandsProcessed == 2) { @@ -1543,7 +1543,7 @@ private void decodeCreateStreamCommand( } else if (server.commandsProcessed == 1) { - newStatement = binding.createSource.generate(server.database, command); + newStatement = binding.createSource.generateStreamSource(server.database, command); } statementBuffer.putBytes(progress, newStatement.getBytes()); From 188852337a201b57d6ed0793247a1e43cca2d2ac Mon Sep 17 00:00:00 2001 From: Akram Yakubov Date: Thu, 3 Oct 2024 15:17:03 -0700 Subject: [PATCH 11/11] Fix regex --- .../internal/statement/RisingwaveCommandTemplate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java index aeb2e088cb..bb65d54a24 100644 --- a/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java +++ b/incubator/binding-risingwave/src/main/java/io/aklivity/zilla/runtime/binding/risingwave/internal/statement/RisingwaveCommandTemplate.java @@ -79,7 +79,7 @@ public RisingwaveCreateTableCommand parserCreateTable( int length) { String query = buffer.getStringWithoutLengthUtf8(offset, length); - query = query.replaceAll("(?i)STREAM", "TABLE"); + query = query.replaceAll("(?i)\\bCREATE\\s+STREAM\\b", "CREATE TABLE"); int includeIndex = query.indexOf("INCLUDE");