RocMarshal commented on a change in pull request #16962:
URL: https://github.com/apache/flink/pull/16962#discussion_r737454112
##########
File path: docs/content/docs/connectors/table/jdbc.md
##########
@@ -458,6 +463,38 @@ SELECT * FROM mydb.`custom_schema.test_table2`;
SELECT * FROM `custom_schema.test_table2`;
```
+### JDBC Catalog for MySQL
+
+#### MySQL Metaspace Mapping
+
+The databases in a MySQL instance are at the same mapping level as the
databases under the catalog registered with `MySQLCatalog`. A MySQL instance
can have multiple databases, each database can have multiple tables.
+In Flink, when querying tables registered by MySQL catalog, users can use
either `database.table_name` or just `table_name`. The default value is the
default database specified when `MySQLCatalog` was created.
+
+Therefore, the metaspace mapping between Flink Catalog and MySQLCatalog is as
following:
+
+| Flink Catalog Metaspace Structure | MySQL Metaspace Structure |
+| :------------------------------------| :-----------------------------------|
+| catalog name (defined in Flink only) | N/A |
+| database name | database name |
+| table name | table_name |
+
+The full path of MySQL table in Flink should be
``"`<catalog>`.`<db>`.`<table>`"``.
+
+Here are some examples to access MySQL tables:
+
+```sql
+-- scan table 'test_table', the default database is 'mydb'.
+SELECT * FROM mysql_catalog.mydb.test_table;
+SELECT * FROM mydb.test_table;
+SELECT * FROM test_table;
+
+-- scan table 'test_table' with the given database.
+SELECT * FROM mysql_catalog.given_database.test_table2;
+SELECT * FROM given_database.test_table2;
+```
+
+<span class="label label-danger">Attention</span> At present, when reading
data from a table, the `YEAR` type is read as the `DATE` type by default, but
writing data in `YEAR` type is not supported by `MySQLCatalog` yet. The same
restrictions apply to the reading and writing of the `GEOMETRY` type. The
`GEOMETRY` type fields will be read as the `BYTES` type by default in reading
data from a table, but the writing of the `GEOMETRY` data type is not supported
by `MySQLCatalog` when writing data into a table.
Review comment:
Thanks a lot for the review. @Airblader .
I kept all existing supported type mappings in flink now. Actually, these
types are readed as bytes .
And GEOMETRY type is not supported in Flink build-in types .
What do you think of making it available after completing GEOMETRY type in
Flink ?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]