[GitHub] [flink] leonardBang commented on a change in pull request #12632: [FLINK-18134][FLINK-18135][docs] Add documentation for Debezium and Canal formats

2020-06-15 Thread GitBox


leonardBang commented on a change in pull request #12632:
URL: https://github.com/apache/flink/pull/12632#discussion_r440548891



##
File path: docs/dev/table/connectors/formats/canal.zh.md
##
@@ -0,0 +1,175 @@
+---
+title: "Canal Format"
+nav-title: Canal
+nav-parent_id: sql-formats
+nav-pos: 5
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Canal](https://github.com/alibaba/canal/wiki) is a CDC (Changelog Data 
Capture) tool that can stream changes in real-time from MySQL into other 
systems. Canal provides an unified format schema for changelog and supports to 
serialize messages using JSON and 
[protobuf](https://developers.google.com/protocol-buffers).
+
+Flink supports to interpret Canal JSON messages as INSERT/UPDATE/DELETE 
messages into Flink SQL system. This is useful in many cases to leverage this 
feature, such as synchronizing incremental data from databases to other 
systems, auditing logs, materialized views on databases, temporal join changing 
history of a database table and so on.
+
+Note: Support for interpreting Canal protobuf messages and emitting Canal 
messages is on the roadmap.
+
+Dependencies
+
+
+In order to setup the Canal format, the following table provides dependency 
information for both projects using a build automation tool (such as Maven or 
SBT) and SQL Client with SQL JAR bundles.
+
+| Maven dependency   | SQL Client JAR |
+| :- | :--|
+| `flink-json`   | Built-in   |
+
+*Note: please refer to [Canal 
documentation](https://github.com/alibaba/canal/wiki) about how to deploy Canal 
to synchronize changelog to message queues.*
+
+
+How to use Canal format
+
+
+Canal provides an unified format for changelog, here is a simple example for 
an update operation captured from a MySQL `products` table:
+
+```json
+{
+  "data": [
+{
+  "id": "111",
+  "name": "scooter",
+  "description": "Big 2-wheel scooter",
+  "weight": "5.18"
+}
+  ],
+  "database": "inventory",
+  "es": 158937356,
+  "id": 9,
+  "isDdl": false,
+  "mysqlType": {
+"id": "INTEGER",
+"name": "VARCHAR(255)",
+"description": "VARCHAR(512)",
+"weight": "FLOAT"
+  },
+  "old": [
+{
+  "weight": "5.15"
+}
+  ],
+  "pkNames": [
+"id"
+  ],
+  "sql": "",
+  "sqlType": {
+"id": 4,
+"name": 12,
+"description": 12,
+"weight": 7
+  },
+  "table": "products",
+  "ts": 1589373560798,
+  "type": "UPDATE"
+}
+```
+
+*Note: please refer to [Canal 
documentation](https://github.com/alibaba/canal/wiki) about the meaning of each 
fields.*
+
+The MySQL `products` table has 4 columns (`id`, `name`, `description` and 
`weight`). The above JSON message is an update change event on the `products` 
table where the `weight` value of the row with `id = 111` is changed from 
`5.18` to `5.15`.
+Assuming this messages is synchronized to Kafka topic `products_binlog`, then 
we can use the following DDL to consume this topic and interpret the change 
events.
+
+
+
+{% highlight sql %}
+CREATE TABLE topic_products (
+  -- schema is totally the same to the MySQL "products" table
+  id BIGINT,
+  name STRING,
+  description STRING,
+  weight DECIMAL(10, 2)
+) WITH (
+ 'connector' = 'kafka',
+ 'topic' = 'products_binlog',
+ 'properties.bootstrap.servers' = 'localhost:9092',
+ 'properties.group.id' = 'testGroup',
+ 'format' = 'canal-json'  -- using canal-json as the format

Review comment:
   no restriction, just a style, I'm fine with current. 





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [flink] leonardBang commented on a change in pull request #12632: [FLINK-18134][FLINK-18135][docs] Add documentation for Debezium and Canal formats

2020-06-15 Thread GitBox


leonardBang commented on a change in pull request #12632:
URL: https://github.com/apache/flink/pull/12632#discussion_r440543606



##
File path: docs/dev/table/connectors/formats/canal.md
##
@@ -0,0 +1,175 @@
+---
+title: "Canal Format"
+nav-title: Canal
+nav-parent_id: sql-formats
+nav-pos: 5
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Canal](https://github.com/alibaba/canal/wiki) is a CDC (Changelog Data 
Capture) tool that can stream changes in real-time from MySQL into other 
systems. Canal provides an unified format schema for changelog and supports to 
serialize messages using JSON and 
[protobuf](https://developers.google.com/protocol-buffers).

Review comment:
   "U" in "unified" is pronounced like "you", that is /ju:/. The sound /j/ 
is a consonant, so we say "a unified architecture", not "an".





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [flink] leonardBang commented on a change in pull request #12632: [FLINK-18134][FLINK-18135][docs] Add documentation for Debezium and Canal formats

2020-06-15 Thread GitBox


leonardBang commented on a change in pull request #12632:
URL: https://github.com/apache/flink/pull/12632#discussion_r440170424



##
File path: docs/dev/table/connectors/formats/canal.md
##
@@ -0,0 +1,175 @@
+---
+title: "Canal Format"
+nav-title: Canal
+nav-parent_id: sql-formats
+nav-pos: 5
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Canal](https://github.com/alibaba/canal/wiki) is a CDC (Changelog Data 
Capture) tool that can stream changes in real-time from MySQL into other 
systems. Canal provides an unified format schema for changelog and supports to 
serialize messages using JSON and 
[protobuf](https://developers.google.com/protocol-buffers).
+
+Flink supports to interpret Canal JSON messages as INSERT/UPDATE/DELETE 
messages into Flink SQL system. This is useful in many cases to leverage this 
feature, such as synchronizing incremental data from databases to other 
systems, auditing logs, materialized views on databases, temporal join changing 
history of a database table and so on.
+
+Note: Support for interpreting Canal protobuf messages and emitting Canal 
messages is on the roadmap.

Review comment:
   Note -> *Note

##
File path: docs/dev/table/connectors/formats/canal.md
##
@@ -0,0 +1,175 @@
+---
+title: "Canal Format"
+nav-title: Canal
+nav-parent_id: sql-formats
+nav-pos: 5
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Canal](https://github.com/alibaba/canal/wiki) is a CDC (Changelog Data 
Capture) tool that can stream changes in real-time from MySQL into other 
systems. Canal provides an unified format schema for changelog and supports to 
serialize messages using JSON and 
[protobuf](https://developers.google.com/protocol-buffers).

Review comment:
an unified ->  a unified

##
File path: docs/dev/table/connectors/formats/debezium.md
##
@@ -0,0 +1,191 @@
+---
+title: "Debezium Format"
+nav-title: Debezium
+nav-parent_id: sql-formats
+nav-pos: 4
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Debezium](https://debezium.io/) is a CDC (Changelog Data Capture) tool that 
can stream changes in real-time from MySQL, PostgreSQL, Oracle, Microsoft SQL 
Server and many other databases into Kafka. Debezium provides an unified format 
schema for changelog and supports to serialize messages using JSON and [Apache 
Avro](https://avro.apache.org/).
+
+Flink supports to interpret Debezium JSON messages as INSERT/UPDATE/DELETE 
messages into Flink SQL system. This is useful in many cases to leverage this 
feature, such as synchronizing incremental data from databases to other 
systems, auditing logs, materialized views on databases, temporal join changing 
history of a database table and so on.
+
+Note: Support for interpreting Debezium Avro messages and emitting Debezium 
messages is on the roadmap.

Review comment:
   Note -> *Note

##
File path: docs/dev/table/connectors/formats/debezium.zh.md
##
@@ -0,0 +1,191 @@
+---
+title: "Debezium Format"
+nav-title: Debezium
+nav-parent_id: sql-formats
+nav-pos: 4
+---
+
+
+Changelog-Data-Capture Format
+Format: Deserialization Schema
+
+* This will be replaced by the TOC
+{:toc}
+
+[Debezium](https://debezium.io/) is a CDC (Changelog Data Capture) tool that 
can stream changes in real-time from MySQL, PostgreSQL, Oracle, Microsoft SQL 
Server and many other databases into Kafka. Debezium provides an unified format 
schema for changelog and supports to serialize messages using JSON and [Apache 
Avro](https://avro.apache.org/).
+
+Flink supports to interpret Debezium JSON messages as INSERT/UPDATE/DELETE 
messages into Flink SQL system. This is useful in many cases to leverage this 
feature, such as synchronizing incremental data from databases to other 
systems, auditing logs, materialized views on databases, temporal join changing 
history of a database table and so on.
+
+Note: Support for interpreting Debezium Avro messages and emitting Debezium 
messages is on the roadmap.

Review comment:
   Note -> *Note

##
File path: docs/dev/table/connectors/hbase.md
##
@@ -62,8 +63,20 @@ CREATE TABLE hTable (
 ) WITH (
  'connector' = 'hbase-1.4',
  'table-name' = 'mytable',
- 'zookeeper.quorum' = 'localhost:2121'
-)
+ 'zookeeper.quorum' = 'localhost:2181'
+);
+
+-- use ROW(...) construction function construct column families and write data 
into the HBase table
+INSERT INTO hTable
+SELECT rowkey, ROW(q1), ROW(q2, q3), ROW(q4, q5, q6) FROM T;

Review comment:
   how about use  ` ROW(f1c1), ROW(f2c1, f2c2), ROW(f3c1, f3c2, f3c3)` ?

##
File path: docs/dev/table/connectors/formats/canal.zh.md
##
@@ -0,0 +1,175 @@
+---
+title: "Canal Format"
+nav-title: Canal
+nav-parent_id: sql-formats
+nav-pos: 5
+---
+
+