You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/10/21 07:49:49 UTC

[GitHub] [shardingsphere] tuichenchuxin opened a new pull request #13196: support bit_xor function.

tuichenchuxin opened a new pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196


   Fixes #13195.
   
   Changes proposed in this pull request:
   -  support bit_xor function
   - add test case
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] strongduanmu commented on a change in pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196#discussion_r733451521



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/BitXorAggregationUnit.java
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.sharding.merge.dql.groupby.aggregation;
+
+import lombok.RequiredArgsConstructor;
+
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * BIT_XOR aggregation unit.
+ */
+@RequiredArgsConstructor
+public final class BitXorAggregationUnit implements AggregationUnit {
+    
+    private BigInteger result;
+    
+    @Override
+    public void merge(final List<Comparable<?>> values) {
+        if (null == values || null == values.get(0)) {
+            return;
+        }
+        if (result == null) {
+            result = BigInteger.ZERO;
+        }
+        result = result.xor((BigInteger) values.get(0));

Review comment:
       @tuichenchuxin Can we use `new BigInteger(values.get(0).toString())` to replace class cast?

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/BitXorAggregationUnit.java
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.sharding.merge.dql.groupby.aggregation;
+
+import lombok.RequiredArgsConstructor;
+
+import java.math.BigInteger;
+import java.util.List;
+
+/**
+ * BIT_XOR aggregation unit.
+ */
+@RequiredArgsConstructor
+public final class BitXorAggregationUnit implements AggregationUnit {
+    
+    private BigInteger result;
+    
+    @Override
+    public void merge(final List<Comparable<?>> values) {
+        if (null == values || null == values.get(0)) {
+            return;
+        }
+        if (result == null) {

Review comment:
       @tuichenchuxin Please move null to the left.

##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/BitXorAggregationUnitTest.java
##########
@@ -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.
+ */
+
+package org.apache.shardingsphere.sharding.merge.dql.groupby.aggregation;
+
+import org.junit.Test;
+
+import java.math.BigInteger;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class BitXorAggregationUnitTest {
+    
+    @Test
+    public void assertBitXorAggregation() {
+        BitXorAggregationUnit bitXorAggregationUnit = new BitXorAggregationUnit();
+        bitXorAggregationUnit.merge(null);

Review comment:
       @tuichenchuxin What is the result of the native mysql XOR operation for null?




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] strongduanmu merged pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] tuichenchuxin commented on a change in pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on a change in pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196#discussion_r733481531



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/BitXorAggregationUnitTest.java
##########
@@ -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.
+ */
+
+package org.apache.shardingsphere.sharding.merge.dql.groupby.aggregation;
+
+import org.junit.Test;
+
+import java.math.BigInteger;
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public final class BitXorAggregationUnitTest {
+    
+    @Test
+    public void assertBitXorAggregation() {
+        BitXorAggregationUnit bitXorAggregationUnit = new BitXorAggregationUnit();
+        bitXorAggregationUnit.merge(null);

Review comment:
       If BIT_XOR operate null will return 0.




-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] sandynz commented on pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
sandynz commented on pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196#issuecomment-948532749


   I did a test on PostgreSQL backend proxy too.
   With customized `bit_xor` and `crc32` function for PostgreSQL.
   
   Part of sharding configuration:
   ```
     shardingAlgorithms:
       database_inline:
         props:
           algorithm-expression: ds_0
         type: INLINE
       t_order_inline:
         props:
           algorithm-expression: t_order_${user_id % 2}
         type: INLINE
   ```
   
   proxy result:
   ```
   sharding_db=> select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from t_order;
     bit_xor
   ------------
    3473013800
   (1 row)
   ```
   
   On sharding tables result:
   ```
   scaling1=# select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from t_order_0;
     bit_xor
   ------------
    2385496147
   (1 row)
   
   scaling1=# select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from t_order_1;
     bit_xor
   ------------
    1093547131
   (1 row)
   
   scaling1=# select int8xor(2385496147,1093547131);
     int8xor
   ------------
    3473013800
   (1 row)
   ```
   
   Each final result is `3473013800`, matched.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] sandynz commented on pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
sandynz commented on pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196#issuecomment-948544302


   More test on PostgreSQL backend proxy.
   
   On empty data source, return empty result, the same as on sharding table:
   ```
   sharding_db=> delete from t_order;
   DELETE 6
   sharding_db=> select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from t_order;
    bit_xor
   ---------
   
   (1 row)
   
   scaling1=# select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from t_order_1;
    bit_xor
   ---------
   
   (1 row)
   ```
   
   With sub-query:
   ```
   sharding_db=> select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from (select * from t_order limit 10) as tmp;
   ERROR:  Error while preparing statement [select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from (select * from t_order limit 10) as tmp]
   ```
   
   Proxy log:
   ```
   [ERROR] 2021-10-21 19:51:42.947 [Connection-4-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.sql.SQLException: Error while preparing statement [select bit_xor(crc32(concat_ws('#',order_id,user_id,status))) from (select * from t_order limit 10) as tmp]
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
   	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:239)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:218)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(CalciteConnectionImpl.java:101)
   	at org.apache.calcite.avatica.AvaticaConnection.prepareStatement(AvaticaConnection.java:175)
   	at org.apache.shardingsphere.infra.executor.sql.federate.original.OriginalFilterableExecutor.execute(OriginalFilterableExecutor.java:84)
   	at org.apache.shardingsphere.infra.executor.sql.federate.original.OriginalFilterableExecutor.executeQuery(OriginalFilterableExecutor.java:77)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.federateExecute(ProxySQLExecutor.java:162)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:134)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxySQLExecutor.execute(ProxySQLExecutor.java:125)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.doExecute(ProxyLockEngine.java:103)
   	at org.apache.shardingsphere.proxy.backend.communication.ProxyLockEngine.execute(ProxyLockEngine.java:81)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:126)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.text.PostgreSQLComQueryExecutor.execute(PostgreSQLComQueryExecutor.java:71)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:99)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:72)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at java.lang.Thread.run(Thread.java:748)
   Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 22 to line 1, column 59: No match found for function signature concat_ws(<CHARACTER>, <NUMERIC>, <NUMERIC>, <CHARACTER>)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:506)
   	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
   	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:902)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5271)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.handleUnresolvedFunction(SqlValidatorImpl.java:1953)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:326)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6257)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6244)
   	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1867)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1852)
   	at org.apache.calcite.sql.SqlOperator.constructArgTypeList(SqlOperator.java:678)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:249)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6257)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6244)
   	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1867)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1852)
   	at org.apache.calcite.sql.SqlOperator.constructArgTypeList(SqlOperator.java:678)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:249)
   	at org.apache.calcite.sql.SqlFunction.deriveType(SqlFunction.java:231)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6257)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl$DeriveTypeVisitor.visit(SqlValidatorImpl.java:6244)
   	at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveTypeImpl(SqlValidatorImpl.java:1867)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.deriveType(SqlValidatorImpl.java:1852)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.expandSelectItem(SqlValidatorImpl.java:461)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelectList(SqlValidatorImpl.java:4414)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3657)
   	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64)
   	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1098)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1069)
   	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:247)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1044)
   	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:750)
   	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:585)
   	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:251)
   	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:215)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:647)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513)
   	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249)
   	at org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(CalciteConnectionImpl.java:229)
   	... 18 common frames omitted
   Caused by: org.apache.calcite.sql.validate.SqlValidatorException: No match found for function signature concat_ws(<CHARACTER>, <NUMERIC>, <NUMERIC>, <CHARACTER>)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
   	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:506)
   	at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:600)
   	... 63 common frames omitted
   ```
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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



[GitHub] [shardingsphere] sandynz commented on pull request #13196: support bit_xor function.

Posted by GitBox <gi...@apache.org>.
sandynz commented on pull request #13196:
URL: https://github.com/apache/shardingsphere/pull/13196#issuecomment-948525241


   Verify on MySQL backend proxy.
   
   Part of sharding configuration:
   ```
     shardingAlgorithms:
       database_inline:
         props:
           algorithm-expression: ds_${user_id % 3}
         type: INLINE
       t_order_inline:
         props:
           algorithm-expression: t_order_${order_id % 2}
         type: INLINE
   ```
   
   proxy result:
   ```
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 2160963500 |
   +--------------------------------------------+
   1 row in set (0.05 sec)
   ```
   
   On sharding tables result:
   ```
   mysql> use scaling_ds_10
   Reading table information for completion of table and column names
   You can turn off this feature to get a quicker startup with -A
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_0;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 2469506043 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_1;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 2411173863 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> use scaling_ds_11
   Reading table information for completion of table and column names
   You can turn off this feature to get a quicker startup with -A
   
   Database changed
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_0;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 3741211375 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_1;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 3445281454 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> use scaling_ds_12
   Reading table information for completion of table and column names
   You can turn off this feature to get a quicker startup with -A
   
   Database changed
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_0;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 2174719289 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_1;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                  242257608 |
   +--------------------------------------------+
   1 row in set (0.00 sec)
   
   mysql> select 2469506043 ^ 2411173863 ^ 3741211375 ^ 3445281454 ^ 2174719289 ^ 242257608;
   +----------------------------------------------------------------------------+
   | 2469506043 ^ 2411173863 ^ 3741211375 ^ 3445281454 ^ 2174719289 ^ 242257608 |
   +----------------------------------------------------------------------------+
   |                                                                 2160963500 |
   +----------------------------------------------------------------------------+
   1 row in set (0.00 sec)
   ```
   
   Current sharding tables is migrated from another mysql database, with 2 dataSources and 2 t_order shards, test result:
   ```
   mysql> use scaling_ds_0
   Reading table information for completion of table and column names
   You can turn off this feature to get a quicker startup with -A
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_0;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 1223574707 |
   +--------------------------------------------+
   1 row in set (0.01 sec)
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_1;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 1866183491 |
   +--------------------------------------------+
   1 row in set (0.02 sec)
   
   mysql> use scaling_ds_1
   Reading table information for completion of table and column names
   You can turn off this feature to get a quicker startup with -A
   
   Database changed
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_0;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                 2227052702 |
   +--------------------------------------------+
   1 row in set (0.01 sec)
   
   mysql> select bit_xor(cast(crc32(order_id) as unsigned)) from t_order_1;
   +--------------------------------------------+
   | bit_xor(cast(crc32(order_id) as unsigned)) |
   +--------------------------------------------+
   |                                  598112450 |
   +--------------------------------------------+
   1 row in set (0.01 sec)
   
   mysql> select 1223574707 ^ 1866183491 ^ 2227052702 ^ 598112450;
   +--------------------------------------------------+
   | 1223574707 ^ 1866183491 ^ 2227052702 ^ 598112450 |
   +--------------------------------------------------+
   |                                       2160963500 |
   +--------------------------------------------------+
   1 row in set (0.00 sec)
   ```
   
   Each of final result is `2160963500`, matched.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

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