Skip to content

Error,when the join clause contains STR_TO_DATE() and conditional_expr is a non-split column #817

@FlyingMao

Description

@FlyingMao
  • dble version:
    5.6.29-dble-9.9.9.9-2e39a04-20181108033407
  • preconditions :
    no
  • configs:

schema.xml

<!DOCTYPE dble:schema SYSTEM "schema.dtd">
<dble:schema xmlns:dble="http://dble.cloud/">
    <schema name="mytest" sqlMaxLimit="100" dataNode="dn1">
        <table name="aly_test" dataNode="dn1,dn2,dn3,dn4" rule="orderID"/>
        <table name="aly_order" dataNode="dn1,dn2,dn3,dn4" rule="orderID"/>
    </schema>
    <dataNode name="dn1" dataHost="10.186.24.45" database="db1"/>
    <dataNode name="dn2" dataHost="10.186.24.46" database="db1"/>
    <dataNode name="dn3" dataHost="10.186.24.45" database="db2"/>
    <dataNode name="dn4" dataHost="10.186.24.46" database="db2"/>
    <dataHost balance="0" maxCon="1000" minCon="10" name="10.186.24.45" switchType="2" slaveThreshold="100">
        <heartbeat>show slave status</heartbeat>
        <writeHost host="hostM1" url="10.186.24.45:3306" password="test" user="test">
        </writeHost>
    </dataHost>
    <dataHost balance="0" maxCon="1000" minCon="10" name="10.186.24.46" switchType="2" slaveThreshold="100">
        <heartbeat>show slave status</heartbeat>
        <writeHost host="hostW1" url="10.186.24.46:3306" password="test" user="test"/>
    </dataHost>
</dble:schema>

rule.xml

<!DOCTYPE dble:rule SYSTEM "rule.dtd">
<dble:rule xmlns:dble="http://dble.cloud/">
    <tableRule name="mod-long">
        <rule>
            <columns>id</columns>
            <algorithm>sharding</algorithm>
        </rule>
    </tableRule>
    <tableRule name="orderID">
        <rule>
            <columns>id</columns>
            <algorithm>sharding</algorithm>
        </rule>
    </tableRule>
    <tableRule name="hash-two">
        <rule>
            <columns>id</columns>
            <algorithm>two-long</algorithm>
        </rule>
    </tableRule>
    <tableRule name="hash-three">
        <rule>
            <columns>id</columns>
            <algorithm>three-long</algorithm>
        </rule>
    </tableRule>
    <function name="sharding" class="Hash">
        <property name="partitionCount">4</property>
        <property name="partitionLength">1</property>
    </function>
    <function name="two-long" class="Hash">
        <property name="partitionCount">2</property>
        <property name="partitionLength">1</property>
    </function>
    <function name="three-long" class="Hash">
        <property name="partitionCount">3</property>
        <property name="partitionLength">1</property>
    </function>
</dble:rule>

server.xml

<!DOCTYPE dble:server SYSTEM "server.dtd">
<dble:server xmlns:dble="http://dble.cloud/">
    <system>
        <property name="useGlobleTableCheck">1</property>
        <property name="dataNodeHeartbeatPeriod">60000</property>
        <property name="sqlExecuteTimeout">1000</property>
        <property name="recordTxn">1</property>
        <property name="xaRecoveryLogBaseDir">/opt/dble/tmlogs/</property>
        <property name="xaRecoveryLogBaseName">xalog</property>
        <property name="xaSessionCheckPeriod">2000</property>
        <property name="xaLogCleanPeriod">100000</property>
        <property name="processors">1</property>
        <property name="processorExecutor">4</property>
        <property name="sequnceHandlerType">2</property>
    </system>
    <firewall/>
    <user name="test">
        <property name="password">test</property>
        <property name="schemas">mytest</property>
         <property name="maxCon">0</property>
    </user>
    <user name="root">
        <property name="password">123456</property>
        <property name="manager">true</property>
    </user>
</dble:server>
  • steps:
    step1. prepare table in dble user port
mysql> drop table if exists aly_order;
Query OK, 0 rows affected (0.02 sec)

mysql> drop table if exists aly_test;
Query OK, 0 rows affected (0.16 sec)

mysql> CREATE TABLE aly_test(id int(10),t_time timestamp(6),name char(120),pad int(11),PRIMARY KEY (id));
Query OK, 0 rows affected (0.08 sec)

mysql> CREATE TABLE aly_order(`id` int(10),`o_time` timestamp(6),`name` char(120),`pad` int(11),PRIMARY KEY (`id`));
Query OK, 0 rows affected (0.04 sec)

step2. execute select in dble user port

 select * from aly_test a inner join aly_order b on a.pad=b.pad where b.o_time>=STR_TO_DATE('2018-11-08 00:00:00','%Y-%m-%d %H:%i: %s');
  • expect result:
    1. step2 result:
mysql> select * from aly_test a inner join aly_order b on a.pad=b.pad where b.o_time>=STR_TO_DATE('2018-11-08 00:00:00','%Y-%m-%d %H:%i: %s'); 
Empty set (0.00 sec)
  • real result:
    1. step2 result:
mysql>  select * from aly_test a inner join aly_order b on a.pad=b.pad where b.o_time>=STR_TO_DATE('2018-11-08 00:00:00','%Y-%m-%d %H:%i: %s'); 
ERROR 1003 (HY000): Incorrect parameter count in the call to native function 'STR_TO_DATE'
  • supplements:
    1. dble explain result
mysql> explain  select * from aly_test a inner join aly_order b on a.pad=b.pad where b.o_time>=STR_TO_DATE('2018-11-08 00:00:00','%Y-%m-%d %H:%i: %s');');
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------+
| DATA_NODE       | TYPE          | SQL/REF                                                                                                                        |
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------+
| dn1_0           | BASE SQL      | select `a`.`id`,`a`.`t_time`,`a`.`name`,`a`.`pad` from  `aly_test` `a` ORDER BY `a`.`pad` ASC                                  |
| dn2_0           | BASE SQL      | select `a`.`id`,`a`.`t_time`,`a`.`name`,`a`.`pad` from  `aly_test` `a` ORDER BY `a`.`pad` ASC                                  |
| dn3_0           | BASE SQL      | select `a`.`id`,`a`.`t_time`,`a`.`name`,`a`.`pad` from  `aly_test` `a` ORDER BY `a`.`pad` ASC                                  |
| dn4_0           | BASE SQL      | select `a`.`id`,`a`.`t_time`,`a`.`name`,`a`.`pad` from  `aly_test` `a` ORDER BY `a`.`pad` ASC                                  |
| merge_1         | MERGE         | dn1_0; dn2_0; dn3_0; dn4_0                                                                                                     |
| shuffle_field_1 | SHUFFLE_FIELD | merge_1                                                                                                                        |
| dn1_1           | BASE SQL      | select `b`.`id`,`b`.`o_time`,`b`.`name`,`b`.`pad` from  `aly_order` `b` where b.o_time >= STR_TO_DATE() ORDER BY `b`.`pad` ASC |
| dn2_1           | BASE SQL      | select `b`.`id`,`b`.`o_time`,`b`.`name`,`b`.`pad` from  `aly_order` `b` where b.o_time >= STR_TO_DATE() ORDER BY `b`.`pad` ASC |
| dn3_1           | BASE SQL      | select `b`.`id`,`b`.`o_time`,`b`.`name`,`b`.`pad` from  `aly_order` `b` where b.o_time >= STR_TO_DATE() ORDER BY `b`.`pad` ASC |
| dn4_1           | BASE SQL      | select `b`.`id`,`b`.`o_time`,`b`.`name`,`b`.`pad` from  `aly_order` `b` where b.o_time >= STR_TO_DATE() ORDER BY `b`.`pad` ASC |
| merge_2         | MERGE         | dn1_1; dn2_1; dn3_1; dn4_1                                                                                                     |
| shuffle_field_3 | SHUFFLE_FIELD | merge_2                                                                                                                        |
| join_1          | JOIN          | shuffle_field_1; shuffle_field_3                                                                                               |
| shuffle_field_2 | SHUFFLE_FIELD | join_1                                                                                                                         |
+-----------------+---------------+--------------------------------------------------------------------------------------------------------------------------------+
14 rows in set (0.00 sec)

/label ~BUG

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions