Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.shardingsphere.infra.instance.metadata.jdbc;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.infra.version.ShardingSphereVersion;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.instance.metadata.InstanceType;
Expand All @@ -26,6 +27,7 @@
/**
* JDBC instance meta data.
*/
@RequiredArgsConstructor
@Getter
public final class JDBCInstanceMetaData implements InstanceMetaData {

Expand All @@ -38,17 +40,7 @@ public final class JDBCInstanceMetaData implements InstanceMetaData {
private final String databaseName;

public JDBCInstanceMetaData(final String id, final String databaseName) {
this.id = id;
ip = IpUtils.getIp();
version = ShardingSphereVersion.VERSION;
this.databaseName = databaseName;
}

public JDBCInstanceMetaData(final String id, final String attributes, final String version, final String databaseName) {
this.id = id;
ip = attributes;
this.version = version;
this.databaseName = databaseName;
this(id, IpUtils.getIp(), ShardingSphereVersion.VERSION, databaseName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
/**
* Update statistics sample option segment.
*/
@NoArgsConstructor
@Getter
@Setter
@NoArgsConstructor
public final class SampleOptionSegment implements SQLSegment {

private int startIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
/**
* Update statistics option segment.
*/
@NoArgsConstructor
@Getter
@Setter
@NoArgsConstructor
public final class StatisticsOptionSegment implements SQLSegment {

private int startIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
/**
* Update statistics strategy segment.
*/
@NoArgsConstructor
@Getter
@Setter
@NoArgsConstructor
public final class StatisticsStrategySegment implements SQLSegment {

private int startIndex;
Expand Down
21 changes: 21 additions & 0 deletions test/it/parser/src/main/resources/case/dal/analyze-table.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-parser-test-cases>
<common sql-case-id="analyze_table_doris" />
</sql-parser-test-cases>
23 changes: 23 additions & 0 deletions test/it/parser/src/main/resources/case/dal/show.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1120,4 +1120,27 @@
<show sql-case-id="show_compactions_with_limit" />
<show sql-case-id="show_compactions_with_compaction_ID" />
<show sql-case-id="show_compactions_all_options" />
<show sql-case-id="show_create_database_doris" />
<show sql-case-id="show_create_view_doris" />
<show sql-case-id="show_create_event_doris" />
<show sql-case-id="show_create_function_doris" />
<show sql-case-id="show_create_procedure_doris" />
<show-create-trigger sql-case-id="show_create_trigger_doris">
<trigger name="trg_test" start-index="20" stop-index="26" />
</show-create-trigger>
<show-create-user sql-case-id="show_create_user_doris">
<user name="user1" start-index="17" stop-index="21" />
</show-create-user>
<show sql-case-id="show_binary_logs_doris" />
<show-binlog-events sql-case-id="show_binlog_events_doris" />
<show sql-case-id="show_processlist_doris" />
<show-open-tables sql-case-id="show_open_tables_doris" />
<show-triggers sql-case-id="show_triggers_doris" />
<show-function-status sql-case-id="show_function_status_doris" />
<show-procedure-status sql-case-id="show_procedure_status_doris" />
<show sql-case-id="show_master_status_doris" />
<show-slave-status sql-case-id="show_slave_status_doris" />
<show-slave-hosts sql-case-id="show_slave_hosts_doris" />
<show-replica-status sql-case-id="show_replica_status_doris" />
<show-relay-log-events sql-case-id="show_relaylog_events_doris" />
</sql-parser-test-cases>
23 changes: 23 additions & 0 deletions test/it/parser/src/main/resources/case/dal/start-stop-slave.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-parser-test-cases>
<common sql-case-id="start_slave_doris" />
<common sql-case-id="stop_slave_doris" />
<common sql-case-id="start_replica_doris" />
</sql-parser-test-cases>
8 changes: 8 additions & 0 deletions test/it/parser/src/main/resources/case/dal/uninstall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@
<uninstall-plugin sql-case-id="uninstall_plugin">
<plugin name="binlog" start-index="17" stop-index="27" />
</uninstall-plugin>

<uninstall-component sql-case-id="uninstall_component_doris">
<component name="file://component_doris" start-index="20" stop-index="43" />
</uninstall-component>

<uninstall-plugin sql-case-id="uninstall_plugin_doris">
<plugin name="audit" start-index="17" stop-index="21" />
</uninstall-plugin>
</sql-parser-test-cases>
1 change: 1 addition & 0 deletions test/it/parser/src/main/resources/case/dcl/alter-user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@
<alter-user sql-case-id="alter_user_alias_to_existing_azure_id" />
<alter-user sql-case-id="alter_user_identified_with_single_quoted" />
<alter-user sql-case-id="alter_user_with_factor" />
<alter-user sql-case-id="alter_user_with_password_doris" />
</sql-parser-test-cases>
10 changes: 10 additions & 0 deletions test/it/parser/src/main/resources/case/dcl/create-user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,14 @@
<create-user sql-case-id="create_user_require_none_doris" />
<create-user sql-case-id="create_user_require_x509_doris" />
<create-user sql-case-id="create_user_require_tls_specified_doris" />
<create-user sql-case-id="create_user_account_unlock_password_expire_interval_doris" />
<create-user sql-case-id="create_user_password_expire_never_doris" />
<create-user sql-case-id="create_user_password_expire_now_doris" />
<create-user sql-case-id="create_user_password_history_length_doris" />
<create-user sql-case-id="create_user_password_reuse_interval_doris" />
<create-user sql-case-id="create_user_password_reuse_interval_default_doris" />
<create-user sql-case-id="create_user_password_require_current_optional_doris" />
<create-user sql-case-id="create_user_password_require_current_yes_doris" />
<create-user sql-case-id="create_user_failed_login_and_lock_time_doris" />
<create-user sql-case-id="create_user_password_lock_time_unbounded_doris" />
</sql-parser-test-cases>
1 change: 1 addition & 0 deletions test/it/parser/src/main/resources/case/dcl/rename-user.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
<sql-parser-test-cases>
<rename-user sql-case-id="rename_user" />
<rename-user sql-case-id="rename_users" />
<rename-user sql-case-id="rename_user_doris" />
</sql-parser-test-cases>
9 changes: 9 additions & 0 deletions test/it/parser/src/main/resources/case/ddl/alter-table.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2592,4 +2592,13 @@
</column-position>
</add-column>
</alter-table>

<alter-table sql-case-id="alter_table_with_algorithm_lock_doris">
<table name="t_order" start-index="12" stop-index="18" />
<add-column>
<column-definition type="INT" start-index="31" stop-index="41">
<column name="col_alg" start-index="31" stop-index="37" />
</column-definition>
</add-column>
</alter-table>
</sql-parser-test-cases>
11 changes: 11 additions & 0 deletions test/it/parser/src/main/resources/case/dml/select.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11963,4 +11963,15 @@
</expression-projection>
</projections>
</select>

<select sql-case-id="select_from_function_table_doris">
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<from start-index="14" stop-index="29">
<function-table start-index="14" stop-index="29">
<table-function function-name="table_func" text="table_func(1, 2)" start-index="14" stop-index="29" />
</function-table>
</from>
</select>
</sql-parser-test-cases>
1 change: 1 addition & 0 deletions test/it/parser/src/main/resources/case/tcl/unlock.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
<unlock sql-case-id="unlock_table" />
<unlock sql-case-id="unlock_tables" />
<unlock sql-case-id="unlock_instance" />
<unlock sql-case-id="unlock_tables_doris" />
</sql-parser-test-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-->

<sql-cases>
<sql-case id="alter_resource_group" value="ALTER RESOURCE GROUP rg" db-types="MySQL" />
<sql-case id="alter_resource_group" value="ALTER RESOURCE GROUP rg" db-types="MySQL,Doris" />
<sql-case id="alter_resource_cost_cpu_time" value="ALTER RESOURCE COST CPU_PER_SESSION 100 CONNECT_TIME 1" db-types="Oracle" />
<sql-case id="alter_resource_cost_cpu" value="ALTER RESOURCE COST CPU_PER_SESSION 100" db-types="Oracle" />
<sql-case id="alter_resource_properties" value="ALTER RESOURCE 'remote_s3' PROPERTIES (&quot;s3.connection.maximum&quot; = &quot;100&quot;);" db-types="Doris" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-cases>
<sql-case id="analyze_table_doris" value="ANALYZE TABLE t_order" db-types="Doris" />
</sql-cases>
6 changes: 3 additions & 3 deletions test/it/parser/src/main/resources/sql/supported/dal/clone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<sql-cases>
<sql-case id="clone_local" value="CLONE LOCAL DATA DIRECTORY = '/path/to/clone_dir'" db-types="MySQL" />
<sql-case id="clone_instance" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password'" db-types="MySQL" />
<sql-case id="clone_instance_with_data_dir" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password' DATA DIRECTORY = '/tmp/clone_dir'" db-types="MySQL" />
<sql-case id="clone_instance_require_ssl" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password' REQUIRE SSL" db-types="MySQL" />
<sql-case id="clone_instance" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password'" db-types="MySQL,Doris" />
<sql-case id="clone_instance_with_data_dir" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password' DATA DIRECTORY = '/tmp/clone_dir'" db-types="MySQL,Doris" />
<sql-case id="clone_instance_require_ssl" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password' REQUIRE SSL" db-types="MySQL,Doris" />
<sql-case id="clone_instance_require_no_ssl" value="CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY 'password' REQUIRE NO SSL" db-types="MySQL" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
-->

<sql-cases>
<sql-case id="create_resource_group" value="CREATE RESOURCE GROUP rg type = user" db-types="MySQL" />
<sql-case id="create_resource_group_with_system_type_and_thread_priority" value="CREATE RESOURCE GROUP rg2 TYPE = SYSTEM THREAD_PRIORITY = -20 DISABLE" db-types="MySQL"/>
<sql-case id="create_resource_group" value="CREATE RESOURCE GROUP rg type = user" db-types="MySQL,Doris" />
<sql-case id="create_resource_group_with_system_type_and_thread_priority" value="CREATE RESOURCE GROUP rg2 TYPE = SYSTEM THREAD_PRIORITY = -20 DISABLE" db-types="MySQL,Doris"/>
<sql-case id="create_sql_block_rule_with_sql" value="CREATE SQL_BLOCK_RULE test_rule PROPERTIES(&quot;sql&quot;=&quot;select \\* from order_analysis&quot;,&quot;global&quot;=&quot;true&quot;,&quot;enable&quot;=&quot;true&quot;)" db-types="Doris" />
<sql-case id="create_sql_block_rule_with_sqlhash" value="CREATE SQL_BLOCK_RULE block_rule_sqlhash PROPERTIES(&quot;sqlHash&quot;=&quot;0e5491b37dbea5e8&quot;,&quot;enable&quot;=&quot;true&quot;)" db-types="Doris" />
<sql-case id="create_sql_block_rule_with_partition_num" value="CREATE SQL_BLOCK_RULE limit_partition_rule PROPERTIES(&quot;partition_num&quot;=&quot;30&quot;,&quot;global&quot;=&quot;true&quot;)" db-types="Doris" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
-->

<sql-cases>
<sql-case id="delimiter" value="DELIMITER |" db-types="MySQL" />
<sql-case id="delimiter" value="DELIMITER |" db-types="MySQL,Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
-->

<sql-cases>
<sql-case id="drop_resource_group" value="DROP RESOURCE GROUP rg" db-types="MySQL" />
<sql-case id="drop_resource_group" value="DROP RESOURCE GROUP rg" db-types="MySQL,Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<sql-case id="set_parameter_equal_list" value="SET extra_float_digits = 1,2,3" db-types="PostgreSQL,openGauss" />
<sql-case id="set_parameter_equal_number_with_signal" value="SET extra_float_digits = -10.5" db-types="PostgreSQL,openGauss" />
<sql-case id="set_names" value="SET NAMES 'utf8' COLLATE 'utf8_general_ci'" db-types="MySQL,Doris" />
<sql-case id="set_resource_group" value="SET RESOURCE GROUP rg" db-types="MySQL" />
<sql-case id="set_resource_group" value="SET RESOURCE GROUP rg" db-types="MySQL,Doris" />
<sql-case id="set_charset_mysql" value="SET NAMES 'utf8'" db-types="MySQL" />
<sql-case id="set_charset_postgresql" value="SET NAMES 'UTF8'" db-types="PostgreSQL" />
<sql-case id="set_client_encoding" value="SET CLIENT_ENCODING TO 'UTF8'" db-types="PostgreSQL" />
Expand Down
19 changes: 19 additions & 0 deletions test/it/parser/src/main/resources/sql/supported/dal/show.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,23 @@
<sql-case id="show_query_stats_all" value="SHOW QUERY STATS ALL" db-types="Doris" />
<sql-case id="show_query_stats_verbose" value="SHOW QUERY STATS VERBOSE" db-types="Doris" />
<sql-case id="show_query_stats_from_table_all_verbose" value="SHOW QUERY STATS FROM test_table ALL VERBOSE" db-types="Doris" />
<sql-case id="show_create_database_doris" value="SHOW CREATE DATABASE test_db" db-types="Doris" />
<sql-case id="show_create_view_doris" value="SHOW CREATE VIEW v_sales" db-types="Doris" />
<sql-case id="show_create_event_doris" value="SHOW CREATE EVENT ev_annual" db-types="Doris" />
<sql-case id="show_create_function_doris" value="SHOW CREATE FUNCTION udf_add" db-types="Doris" />
<sql-case id="show_create_procedure_doris" value="SHOW CREATE PROCEDURE proc_test" db-types="Doris" />
<sql-case id="show_create_trigger_doris" value="SHOW CREATE TRIGGER trg_test" db-types="Doris" />
<sql-case id="show_create_user_doris" value="SHOW CREATE USER user1" db-types="Doris" />
<sql-case id="show_binary_logs_doris" value="SHOW BINARY LOGS" db-types="Doris" />
<sql-case id="show_binlog_events_doris" value="SHOW BINLOG EVENTS" db-types="Doris" />
<sql-case id="show_processlist_doris" value="SHOW PROCESSLIST" db-types="Doris" />
<sql-case id="show_open_tables_doris" value="SHOW OPEN TABLES" db-types="Doris" />
<sql-case id="show_triggers_doris" value="SHOW TRIGGERS" db-types="Doris" />
<sql-case id="show_function_status_doris" value="SHOW FUNCTION STATUS" db-types="Doris" />
<sql-case id="show_procedure_status_doris" value="SHOW PROCEDURE STATUS" db-types="Doris" />
<sql-case id="show_master_status_doris" value="SHOW MASTER STATUS" db-types="Doris" />
<sql-case id="show_slave_status_doris" value="SHOW SLAVE STATUS" db-types="Doris" />
<sql-case id="show_slave_hosts_doris" value="SHOW SLAVE HOSTS" db-types="Doris" />
<sql-case id="show_replica_status_doris" value="SHOW REPLICA STATUS" db-types="Doris" />
<sql-case id="show_relaylog_events_doris" value="SHOW RELAYLOG EVENTS" db-types="Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
-->

<sql-cases>
<sql-case id="shutdown" value="SHUTDOWN" db-types="MySQL" />
<sql-case id="shutdown" value="SHUTDOWN" db-types="MySQL,Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->

<sql-cases>
<sql-case id="start_slave_doris" value="START SLAVE SQL_THREAD USER='u'" db-types="Doris" />
<sql-case id="stop_slave_doris" value="STOP SLAVE SQL_THREAD" db-types="Doris" />
<sql-case id="start_replica_doris" value="START REPLICA SQL_THREAD" db-types="Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
<sql-case id="uninstall_component" value="UNINSTALL COMPONENT 'file://component1'" db-types="MySQL" />
<sql-case id="uninstall_components" value="UNINSTALL COMPONENT 'file://component1', 'file://component2'" db-types="MySQL" />
<sql-case id="uninstall_plugin" value="UNINSTALL PLUGIN binlog" db-types="MySQL" />
<sql-case id="uninstall_component_doris" value="UNINSTALL COMPONENT 'file://component_doris'" db-types="Doris" />
<sql-case id="uninstall_plugin_doris" value="UNINSTALL PLUGIN audit" db-types="Doris" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<sql-case id="alter_user_with_password_options" value="ALTER USER user1 PASSWORD EXPIRE DEFAULT PASSWORD HISTORY DEFAULT" db-types="MySQL" />
<sql-case id="alter_user_with_lock_option" value="ALTER USER user1 ACCOUNT LOCK" db-types="MySQL" />
<sql-case id="alter_user_with_options" value="ALTER USER user1 WITH MAX_QUERIES_PER_HOUR 1 MAX_UPDATES_PER_HOUR 1 PASSWORD EXPIRE DEFAULT PASSWORD HISTORY DEFAULT ACCOUNT LOCK" db-types="MySQL" />
<sql-case id="alter_user_with_password_doris" value="ALTER USER user1 IDENTIFIED BY 'pwd_doris'" db-types="Doris" />
<sql-case id="alter_external_user" value="ALTER USER user1 IDENTIFIED EXTERNALLY" db-types="Oracle" />
<sql-case id="alter_global_user" value="ALTER USER user1 IDENTIFIED GLOBALLY AS 'CN=user1'" db-types="Oracle" />
<sql-case id="alter_user_with_tablespace_option" value="ALTER USER user1 DEFAULT TABLESPACE tablespace1" db-types="Oracle" />
Expand Down
Loading