You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/04/11 00:16:44 UTC
[shardingsphere] branch master updated: Add mysql schema tables (#25087)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 888962268cc Add mysql schema tables (#25087)
888962268cc is described below
commit 888962268cc9675477f1c0e2b91251db2b5d29f0
Author: ZhangCheng <fl...@outlook.com>
AuthorDate: Tue Apr 11 08:16:34 2023 +0800
Add mysql schema tables (#25087)
---
.../schema/builder/SystemSchemaBuilderRule.java | 3 +-
.../resources/schema/mysql/mysql/columns_priv.yaml | 78 ++++++++
.../resources/schema/mysql/mysql/engine_cost.yaml | 70 ++++++++
.../main/resources/schema/mysql/mysql/event.yaml | 198 +++++++++++++++++++++
.../main/resources/schema/mysql/mysql/func.yaml | 54 ++++++
.../resources/schema/mysql/mysql/general_log.yaml | 67 +++++++
.../schema/mysql/mysql/gtid_executed.yaml | 46 +++++
.../schema/mysql/mysql/help_category.yaml | 56 ++++++
.../resources/schema/mysql/mysql/help_keyword.yaml | 40 +++++
.../schema/mysql/mysql/help_relation.yaml | 38 ++++
.../builder/SystemSchemaBuilderRuleTest.java | 9 +-
.../schema/builder/SystemSchemaBuilderTest.java | 12 +-
.../dataset/db/select_mysql_mysql_columns_priv.xml | 28 +++
.../cases/dql/dataset/db/select_mysql_mysql_db.xml | 43 +++++
.../dataset/db/select_mysql_mysql_engine_cost.xml | 27 +++
.../dql/dataset/db/select_mysql_mysql_event.xml | 43 +++++
.../dql/dataset/db/select_mysql_mysql_func.xml | 25 +++
.../dataset/db/select_mysql_mysql_general_log.xml | 27 +++
.../db/select_mysql_mysql_gtid_executed.xml | 24 +++
.../db/select_mysql_mysql_help_category.xml | 25 +++
.../dataset/db/select_mysql_mysql_help_keyword.xml | 23 +++
.../db/select_mysql_mysql_help_relation.xml | 23 +++
.../dql/dql-integration-select-system-schema.xml | 40 +++++
23 files changed, 991 insertions(+), 8 deletions(-)
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
index 6bd0171108f..d9d1fed01f0 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRule.java
@@ -46,7 +46,8 @@ public enum SystemSchemaBuilderRule {
"processlist", "profiling", "referential_constraints", "routines", "schema_privileges", "schemata", "session_status", "session_variables", "statistics",
"table_constraints", "table_privileges", "tables", "tablespaces", "triggers", "user_privileges", "views"))),
- MYSQL_MYSQL("MySQL", "mysql", new HashSet<>(Collections.singleton("db"))),
+ MYSQL_MYSQL("MySQL", "mysql", new HashSet<>(Arrays.asList("columns_priv", "db", "engine_cost", "event", "func", "general_log", "gtid_executed",
+ "help_category", "help_keyword", "help_relation"))),
MYSQL_PERFORMANCE_SCHEMA("MySQL", "performance_schema", new HashSet<>(Collections.singleton("accounts"))),
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/columns_priv.yaml b/infra/common/src/main/resources/schema/mysql/mysql/columns_priv.yaml
new file mode 100644
index 00000000000..d74ad885af0
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/columns_priv.yaml
@@ -0,0 +1,78 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: columns_priv
+columns:
+ host:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: Host
+ primaryKey: true
+ unsigned: false
+ visible: true
+ db:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: Db
+ primaryKey: true
+ unsigned: false
+ visible: true
+ user:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: User
+ primaryKey: true
+ unsigned: false
+ visible: true
+ table_name:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: Table_name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ column_name:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: Column_name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ timestamp:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: Timestamp
+ primaryKey: false
+ unsigned: false
+ visible: true
+ column_priv:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: Column_priv
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/engine_cost.yaml b/infra/common/src/main/resources/schema/mysql/mysql/engine_cost.yaml
new file mode 100644
index 00000000000..0212cf49001
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/engine_cost.yaml
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: engine_cost
+columns:
+ engine_name:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: engine_name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ device_type:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: device_type
+ primaryKey: true
+ unsigned: false
+ visible: true
+ cost_name:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: cost_name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ cost_value:
+ caseSensitive: false
+ dataType: 7
+ generated: false
+ name: cost_value
+ primaryKey: false
+ unsigned: false
+ visible: true
+ last_update:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: last_update
+ primaryKey: false
+ unsigned: false
+ visible: true
+ comment:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: comment
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/event.yaml b/infra/common/src/main/resources/schema/mysql/mysql/event.yaml
new file mode 100644
index 00000000000..57c023f8606
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/event.yaml
@@ -0,0 +1,198 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: event
+columns:
+ db:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: db
+ primaryKey: true
+ unsigned: false
+ visible: true
+ name:
+ caseSensitive: false
+ dataType: 1
+ generated: false
+ name: name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ body:
+ caseSensitive: false
+ dataType: -4
+ generated: false
+ name: body
+ primaryKey: false
+ unsigned: false
+ visible: true
+ definer:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: definer
+ primaryKey: false
+ unsigned: false
+ visible: true
+ execute_at:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: execute_at
+ primaryKey: false
+ unsigned: false
+ visible: true
+ interval_value:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: interval_value
+ primaryKey: false
+ unsigned: false
+ visible: true
+ interval_field:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: interval_field
+ primaryKey: false
+ unsigned: false
+ visible: true
+ created:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: created
+ primaryKey: false
+ unsigned: false
+ visible: true
+ modified:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: modified
+ primaryKey: false
+ unsigned: false
+ visible: true
+ last_executed:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: last_executed
+ primaryKey: false
+ unsigned: false
+ visible: true
+ starts:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: starts
+ primaryKey: false
+ unsigned: false
+ visible: true
+ ends:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: ends
+ primaryKey: false
+ unsigned: false
+ visible: true
+ status:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: status
+ primaryKey: false
+ unsigned: false
+ visible: true
+ on_completion:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: on_completion
+ primaryKey: false
+ unsigned: false
+ visible: true
+ sql_mode:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: sql_mode
+ primaryKey: false
+ unsigned: true
+ visible: true
+ comment:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: comment
+ primaryKey: false
+ unsigned: false
+ visible: true
+ originator:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: originator
+ primaryKey: false
+ unsigned: true
+ visible: true
+ time_zone:
+ caseSensitive: false
+ dataType: 1
+ generated: false
+ name: time_zone
+ primaryKey: false
+ unsigned: false
+ visible: true
+ character_set_client:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: character_set_client
+ primaryKey: false
+ unsigned: false
+ visible: true
+ collation_connection:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: collation_connection
+ primaryKey: false
+ unsigned: false
+ visible: true
+ db_collation:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: db_collation
+ primaryKey: false
+ unsigned: false
+ visible: true
+ body_utf8:
+ caseSensitive: false
+ dataType: -4
+ generated: false
+ name: body_utf8
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/func.yaml b/infra/common/src/main/resources/schema/mysql/mysql/func.yaml
new file mode 100644
index 00000000000..7d04947f3a7
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/func.yaml
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: func
+columns:
+ name:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: name
+ primaryKey: true
+ unsigned: false
+ visible: true
+ ret:
+ caseSensitive: false
+ dataType: -6
+ generated: false
+ name: ret
+ primaryKey: false
+ unsigned: false
+ visible: true
+ dl:
+ caseSensitive: true
+ dataType: 1
+ generated: false
+ name: dl
+ primaryKey: false
+ unsigned: false
+ visible: true
+ type:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: type
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/general_log.yaml b/infra/common/src/main/resources/schema/mysql/mysql/general_log.yaml
new file mode 100644
index 00000000000..55c507fb601
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/general_log.yaml
@@ -0,0 +1,67 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: general_log
+columns:
+ event_time:
+ caseSensitive: false
+ dataType: 93
+ generated: false
+ name: event_time
+ primaryKey: false
+ unsigned: false
+ visible: true
+ user_host:
+ caseSensitive: false
+ dataType: -1
+ generated: false
+ name: user_host
+ primaryKey: false
+ unsigned: false
+ visible: true
+ thread_id:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: thread_id
+ primaryKey: false
+ unsigned: true
+ visible: true
+ server_id:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: server_id
+ primaryKey: false
+ unsigned: true
+ visible: true
+ command_type:
+ caseSensitive: false
+ dataType: 12
+ generated: false
+ name: command_type
+ primaryKey: false
+ unsigned: false
+ visible: true
+ argument:
+ caseSensitive: false
+ dataType: -4
+ generated: false
+ name: argument
+ primaryKey: false
+ unsigned: false
+ visible: true
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/gtid_executed.yaml b/infra/common/src/main/resources/schema/mysql/mysql/gtid_executed.yaml
new file mode 100644
index 00000000000..7cdf0cfb54e
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/gtid_executed.yaml
@@ -0,0 +1,46 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: gtid_executed
+columns:
+ source_uuid:
+ caseSensitive: false
+ dataType: 1
+ generated: false
+ name: source_uuid
+ primaryKey: true
+ unsigned: false
+ visible: true
+ interval_start:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: interval_start
+ primaryKey: true
+ unsigned: false
+ visible: true
+ interval_end:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: interval_end
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/help_category.yaml b/infra/common/src/main/resources/schema/mysql/mysql/help_category.yaml
new file mode 100644
index 00000000000..70ac7824e5e
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/help_category.yaml
@@ -0,0 +1,56 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: help_category
+columns:
+ help_category_id:
+ caseSensitive: false
+ dataType: 5
+ generated: false
+ name: help_category_id
+ primaryKey: true
+ unsigned: true
+ visible: true
+ name:
+ caseSensitive: false
+ dataType: 1
+ generated: false
+ name: name
+ primaryKey: false
+ unsigned: false
+ visible: true
+ parent_category_id:
+ caseSensitive: false
+ dataType: 5
+ generated: false
+ name: parent_category_id
+ primaryKey: false
+ unsigned: true
+ visible: true
+ url:
+ caseSensitive: false
+ dataType: -1
+ generated: false
+ name: url
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
+ name:
+ name: name
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/help_keyword.yaml b/infra/common/src/main/resources/schema/mysql/mysql/help_keyword.yaml
new file mode 100644
index 00000000000..9d1c37baf99
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/help_keyword.yaml
@@ -0,0 +1,40 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: help_keyword
+columns:
+ help_keyword_id:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: help_keyword_id
+ primaryKey: true
+ unsigned: true
+ visible: true
+ name:
+ caseSensitive: false
+ dataType: 1
+ generated: false
+ name: name
+ primaryKey: false
+ unsigned: false
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
+ name:
+ name: name
diff --git a/infra/common/src/main/resources/schema/mysql/mysql/help_relation.yaml b/infra/common/src/main/resources/schema/mysql/mysql/help_relation.yaml
new file mode 100644
index 00000000000..b7b2d6a82cc
--- /dev/null
+++ b/infra/common/src/main/resources/schema/mysql/mysql/help_relation.yaml
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+name: help_relation
+columns:
+ help_topic_id:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: help_topic_id
+ primaryKey: true
+ unsigned: true
+ visible: true
+ help_keyword_id:
+ caseSensitive: false
+ dataType: 4
+ generated: false
+ name: help_keyword_id
+ primaryKey: true
+ unsigned: true
+ visible: true
+indexes:
+ primary:
+ name: PRIMARY
diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
index 60cd3e3d76d..9ee806a5f56 100644
--- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
+++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderRuleTest.java
@@ -30,9 +30,12 @@ class SystemSchemaBuilderRuleTest {
@Test
void assertValueOfSchemaPathSuccess() {
- SystemSchemaBuilderRule actual = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "information_schema");
- assertThat(actual, is(SystemSchemaBuilderRule.MYSQL_INFORMATION_SCHEMA));
- assertThat(actual.getTables().size(), is(61));
+ SystemSchemaBuilderRule actualInformationSchema = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "information_schema");
+ assertThat(actualInformationSchema, is(SystemSchemaBuilderRule.MYSQL_INFORMATION_SCHEMA));
+ assertThat(actualInformationSchema.getTables().size(), is(61));
+ SystemSchemaBuilderRule actualMySQLSchema = SystemSchemaBuilderRule.valueOf(new MySQLDatabaseType().getType(), "mysql");
+ assertThat(actualMySQLSchema, is(SystemSchemaBuilderRule.MYSQL_MYSQL));
+ assertThat(actualMySQLSchema.getTables().size(), is(10));
}
@Test
diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
index 71cb19dd6a5..3253642d57b 100644
--- a/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
+++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/metadata/database/schema/builder/SystemSchemaBuilderTest.java
@@ -33,10 +33,14 @@ class SystemSchemaBuilderTest {
@Test
void assertBuildForMySQL() {
- Map<String, ShardingSphereSchema> actual = SystemSchemaBuilder.build("information_schema", new MySQLDatabaseType());
- assertThat(actual.size(), is(1));
- assertTrue(actual.containsKey("information_schema"));
- assertThat(actual.get("information_schema").getTables().size(), is(61));
+ Map<String, ShardingSphereSchema> actualInformationSchema = SystemSchemaBuilder.build("information_schema", new MySQLDatabaseType());
+ assertThat(actualInformationSchema.size(), is(1));
+ assertTrue(actualInformationSchema.containsKey("information_schema"));
+ assertThat(actualInformationSchema.get("information_schema").getTables().size(), is(61));
+ Map<String, ShardingSphereSchema> actualMySQLSchema = SystemSchemaBuilder.build("mysql", new MySQLDatabaseType());
+ assertThat(actualMySQLSchema.size(), is(1));
+ assertTrue(actualMySQLSchema.containsKey("mysql"));
+ assertThat(actualMySQLSchema.get("mysql").getTables().size(), is(10));
}
@Test
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_columns_priv.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_columns_priv.xml
new file mode 100644
index 00000000000..6e20590d892
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_columns_priv.xml
@@ -0,0 +1,28 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="host" />
+ <column name="db" />
+ <column name="user" />
+ <column name="table_name" />
+ <column name="column_name" />
+ <column name="timestamp" />
+ <column name="column_priv" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_db.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_db.xml
new file mode 100644
index 00000000000..9e8a80e07b5
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_db.xml
@@ -0,0 +1,43 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="host" />
+ <column name="db" />
+ <column name="user" />
+ <column name="select_priv" />
+ <column name="insert_priv" />
+ <column name="update_priv" />
+ <column name="delete_priv" />
+ <column name="create_priv" />
+ <column name="drop_priv" />
+ <column name="grant_priv" />
+ <column name="references_priv" />
+ <column name="index_priv" />
+ <column name="alter_priv" />
+ <column name="create_tmp_table_priv" />
+ <column name="lock_tables_priv" />
+ <column name="create_view_priv" />
+ <column name="show_view_priv" />
+ <column name="create_routine_priv" />
+ <column name="alter_routine_priv" />
+ <column name="execute_priv" />
+ <column name="event_priv" />
+ <column name="trigger_priv" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_engine_cost.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_engine_cost.xml
new file mode 100644
index 00000000000..2d8d10bfa55
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_engine_cost.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="engine_name" />
+ <column name="device_type" />
+ <column name="cost_name" />
+ <column name="cost_value" />
+ <column name="last_update" />
+ <column name="comment" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_event.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_event.xml
new file mode 100644
index 00000000000..13e7068d4bf
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_event.xml
@@ -0,0 +1,43 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="db" />
+ <column name="name" />
+ <column name="body" />
+ <column name="definer" />
+ <column name="execute_at" />
+ <column name="interval_value" />
+ <column name="interval_field" />
+ <column name="created" />
+ <column name="modified" />
+ <column name="last_executed" />
+ <column name="starts" />
+ <column name="ends" />
+ <column name="status" />
+ <column name="on_completion" />
+ <column name="sql_mode" />
+ <column name="comment" />
+ <column name="originator" />
+ <column name="time_zone" />
+ <column name="character_set_client" />
+ <column name="collation_connection" />
+ <column name="db_collation" />
+ <column name="body_utf8" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_func.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_func.xml
new file mode 100644
index 00000000000..248b896d620
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_func.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="name" />
+ <column name="ret" />
+ <column name="dl" />
+ <column name="type" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_general_log.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_general_log.xml
new file mode 100644
index 00000000000..647936254e2
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_general_log.xml
@@ -0,0 +1,27 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="event_time" />
+ <column name="user_host" />
+ <column name="thread_id" />
+ <column name="server_id" />
+ <column name="command_type" />
+ <column name="argument" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_gtid_executed.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_gtid_executed.xml
new file mode 100644
index 00000000000..d523390e402
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_gtid_executed.xml
@@ -0,0 +1,24 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="source_uuid" />
+ <column name="interval_start" />
+ <column name="interval_end" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_category.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_category.xml
new file mode 100644
index 00000000000..95b53412dfe
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_category.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="help_category_id" />
+ <column name="name" />
+ <column name="parent_category_id" />
+ <column name="url" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_keyword.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_keyword.xml
new file mode 100644
index 00000000000..0080047222c
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_keyword.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="help_keyword_id" />
+ <column name="name" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_relation.xml b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_relation.xml
new file mode 100644
index 00000000000..8fd3c0b3917
--- /dev/null
+++ b/test/e2e/sql/src/test/resources/cases/dql/dataset/db/select_mysql_mysql_help_relation.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="help_topic_id" />
+ <column name="help_keyword_id" />
+ </metadata>
+</dataset>
diff --git a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-system-schema.xml b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-system-schema.xml
index ec8e9fd0fb1..8b4a1fec560 100644
--- a/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-system-schema.xml
+++ b/test/e2e/sql/src/test/resources/cases/dql/dql-integration-select-system-schema.xml
@@ -244,4 +244,44 @@
<test-case sql="SELECT * FROM information_schema.user_privileges" db-types="MySQL" scenario-types="db">
<assertion expected-data-file="select_mysql_information_schema_user_privileges.xml" />
</test-case>
+
+ <test-case sql="SELECT * FROM mysql.columns_priv" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_columns_priv.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.db" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_db.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.engine_cost" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_engine_cost.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.event" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_event.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.func" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_func.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.general_log" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_general_log.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.gtid_executed" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_gtid_executed.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.help_category" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_help_category.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.help_keyword" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_help_keyword.xml" />
+ </test-case>
+
+ <test-case sql="SELECT * FROM mysql.help_relation" db-types="MySQL" scenario-types="db">
+ <assertion expected-data-file="select_mysql_mysql_help_relation.xml" />
+ </test-case>
</integration-test-cases>