Skip to content

Commit

Permalink
Fix RAL E2E (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaigorJiang authored Oct 30, 2024
1 parent ae006d0 commit e8a5dc5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,120 +67,12 @@ public enum TemporaryConfigurationPropertyKey implements TypedPropertyKey {
@SphereEx
META_DATA_CONSISTENCY_TIMEOUT_MILLISECONDS("meta-data-consistency-timeout-milliseconds", "60000", long.class, false),

/**
* Insert select batch size.
*/
@SphereEx
INSERT_SELECT_BATCH_SIZE("insert-select-batch-size", "1000", int.class, false),

/**
* Global index update delete select batch size.
*/
@SphereEx
GLOBAL_INDEX_UPDATE_DELETE_SELECT_BATCH_SIZE("global-index-update-delete-select-batch-size", "1000", int.class, false),

/**
* Global index table status check enabled.
*/
@SphereEx
GLOBAL_INDEX_TABLE_STATUS_CHECK_ENABLED("global-index-table-status-check-enabled", String.valueOf(Boolean.TRUE), boolean.class, false),

/**
* SQL federation shuffle join enabled.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_ENABLED("sql-federation-shuffle-join-enabled", "false", boolean.class, false),

/**
* SQL federation shuffle join preferred datasource.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_PREFERRED_DATASOURCE("sql-federation-shuffle-join-preferred-datasource", "", String.class, false),

/**
* SQL federation shuffle join table fetch split count.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_TABLE_FETCH_SPLIT_COUNT("sql-federation-shuffle-join-table-fetch-split-count", "10000", int.class, false),

/**
* SQL federation shuffle join data transfer executor size.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_DATA_TRANSFER_EXECUTOR_SIZE("sql-federation-shuffle-join-data-transfer-executor-size", "20", int.class, true),

/**
* SQL federation shuffle join data transfer queue size.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_DATA_TRANSFER_QUEUE_SIZE("sql-federation-shuffle-join-data-transfer-queue-size", "100", int.class, true),

/**
* SQL federation shuffle join data transfer discard auto increment column enabled.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_DATA_TRANSFER_DISCARD_AUTO_INCREMENT_COLUMN_ENABLED("sql-federation-shuffle-join-data-transfer-discard-auto-increment-column-enabled", "false", boolean.class, false),

/**
* SQL federation shuffle join explain detection enabled.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_EXPLAIN_DETECTION_ENABLED("sql-federation-shuffle-join-explain-detection-enabled", "true", boolean.class, false),

/**
* SQL federation shuffle join explain detection enabled.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_EXPLAIN_ROWS_WARNED_THRESHOLD("sql-federation-shuffle-join-explain-rows-warned-threshold", "10000000", long.class, false),

/**
* SQL federation shuffle join analysis table dependency by count.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_ANALYSIS_TABLE_DEPENDENCY_BY_COUNT("sql-federation-shuffle-join-analysis-table-dependency-by-count", "false", boolean.class, false),

/**
* SQL federation shuffle join analysis table dependency by explain.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_ANALYSIS_TABLE_DEPENDENCY_BY_EXPLAIN("sql-federation-shuffle-join-analysis-table-dependency-by-explain", "true", boolean.class, false),

/**
* SQL federation shuffle join rewrite unique key to key enabled.
*/
@SphereEx
SQL_FEDERATION_SHUFFLE_JOIN_REWRITE_UNIQUE_KEY_TO_KEY_ENABLED("sql-federation-shuffle-join-rewrite-unique-key-to-key-enabled", "true", boolean.class, false),

/**
* Instance connection enabled.
*/
@SphereEx
INSTANCE_CONNECTION_ENABLED("instance-connection-enabled", String.valueOf(Boolean.FALSE), boolean.class, false),

/**
* License url.
*/
@SphereEx
LICENSE_URL("license-url", "", String.class, true),

/**
* Cipher instance cache enabled.
*/
@SphereEx
CIPHER_INSTANCE_CACHE_ENABLED("cipher-instance-cache-enabled", String.valueOf(Boolean.TRUE), boolean.class, false),

/**
* Batch performance enabled.
*/
@SphereEx
BATCH_PERFORMANCE_ENABLED("batch-performance-enabled", String.valueOf(Boolean.TRUE), boolean.class, false),

/**
* DDL consistency enabled.
*/
@SphereEx
DDL_CONSISTENCY_ENABLED("ddl-consistency-enabled", String.valueOf(Boolean.FALSE), boolean.class, false),

@SphereEx
DROP_CURRENT_USER_ENABLED("drop-current-user-enabled", String.valueOf(Boolean.TRUE), boolean.class, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

grammar RALStatement;

import BaseRule;
// SPEX CHANGED: BEGIN
import SphereExKeyword, BaseRule;
// SPEX CHANGED: END

setDistVariable
: SET DIST VARIABLE variableName EQ_ variableValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ execute
| showKeyGenerateAlgorithmPlugins
| showLoadBalanceAlgorithmPlugins
// SPEX ADDED: BEGIN
| showSeriesNumber
| showDistLocks
| unlockDistLock
| showLastExecuteFailedNodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.shardingsphere.distsql.parser.core.kernel;

import com.sphereex.dbplusengine.SphereEx;
import com.sphereex.dbplusengine.SphereEx.Type;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementBaseVisitor;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.AlgorithmDefinitionContext;
Expand Down Expand Up @@ -229,9 +231,10 @@ public ASTNode visitDatabaseName(final DatabaseNameContext ctx) {
return new DatabaseSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), new IdentifierValue(ctx.getText()));
}

@SphereEx(Type.MODIFY)
@Override
public ASTNode visitSetDistVariable(final SetDistVariableContext ctx) {
return new SetDistVariableStatement(getIdentifierValue(ctx.variableName()), getIdentifierValue(ctx.variableValue()));
return new SetDistVariableStatement(getIdentifierValue(ctx.variableName()), getQuotedContent(ctx.variableValue()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void assertExecute() {
executor.setConnectionContext(new DistSQLConnectionContext(mock(QueryContext.class), 1,
mock(DatabaseType.class), mock(DatabaseConnectionManager.class), mock(ExecutorStatementManager.class)));
Collection<LocalDataQueryResultRow> actual = executor.getRows(mock(ShowDistVariablesStatement.class), contextManager);
assertThat(actual.size(), is(45));
assertThat(actual.size(), is(27));
LocalDataQueryResultRow row = actual.iterator().next();
assertThat(row.getCell(1), is("agent_plugins_enabled"));
assertThat(row.getCell(2), is("true"));
Expand All @@ -74,9 +74,9 @@ void assertExecuteWithLike() {
executor.setConnectionContext(new DistSQLConnectionContext(mock(QueryContext.class), 1,
mock(DatabaseType.class), mock(DatabaseConnectionManager.class), mock(ExecutorStatementManager.class)));
Collection<LocalDataQueryResultRow> actual = executor.getRows(new ShowDistVariablesStatement("sql_%"), contextManager);
assertThat(actual.size(), is(13));
assertThat(actual.size(), is(2));
Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
assertThat(iterator.next().getCell(1), is("sql_federation_shuffle_join_analysis_table_dependency_by_count"));
assertThat(iterator.next().getCell(1), is("sql_federation_shuffle_join_analysis_table_dependency_by_explain"));
assertThat(iterator.next().getCell(1), is("sql_show"));
assertThat(iterator.next().getCell(1), is("sql_simple"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@
<row values="cached_connections| 0" />
<row values="cdc_server_port| 33071" />
<row values="check_table_metadata_enabled| false" />
<!-- SPEX ADDED: BEGIN -->
<row values="dml_resource_lock_check_enabled| false" />
<row values="drop_current_user_enabled| true" />
<row values="instance_connection_enabled| false" />
<!-- SPEX ADDED: END -->
<row values="kernel_executor_size| 16" />
<!-- SPEX ADDED: BEGIN -->
<row values="lock_time_out_milliseconds| 60000" />
<!-- SPEX ADDED: END -->
<row values="max_connections_size_per_query| 1" />
<!-- SPEX ADDED: BEGIN -->
<row values="meta_data_consistency_enabled| true" />
<row values="meta_data_consistency_timeout_milliseconds| 60000" />
<!-- SPEX ADDED: END -->
<row values="proxy_backend_query_fetch_size| -1" />
<row values="proxy_default_port| 3307" />
<row values="proxy_frontend_database_protocol_type| " />
Expand Down
15 changes: 8 additions & 7 deletions test/e2e/sql/src/test/resources/cases/rdl/e2e-rdl-alter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@
<!-- </assertion>-->
<!-- </test-case>-->

<test-case sql="ALTER MASK RULE t_mask (COLUMNS((NAME=order_id, TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*')))));">
<assertion expected-data-file="alter_mask_rule.xml">
<initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />
<assertion-sql sql="SHOW MASK RULES;" />
<destroy-sql sql="DROP MASK RULE t_mask;" />
</assertion>
</test-case>
<!-- FIXME https://github.com/apache/shardingsphere/issues/33450-->
<!-- <test-case sql="ALTER MASK RULE t_mask (COLUMNS((NAME=order_id, TYPE(NAME='MASK_FROM_X_TO_Y', PROPERTIES('from-x'=1, 'to-y'=2, 'replace-char'='*')))));">-->
<!-- <assertion expected-data-file="alter_mask_rule.xml">-->
<!-- <initial-sql sql="CREATE MASK RULE t_mask (COLUMNS((NAME=order_id,TYPE(NAME='MD5'))));" />-->
<!-- <assertion-sql sql="SHOW MASK RULES;" />-->
<!-- <destroy-sql sql="DROP MASK RULE t_mask;" />-->
<!-- </assertion>-->
<!-- </test-case>-->
</e2e-test-cases>

0 comments on commit e8a5dc5

Please sign in to comment.