Skip to content

execute sql:“select id,c from test_shard group by c having id<=1 or c = 'bb';” err NPE  #2073

@wenyh1

Description

@wenyh1
  • dble version:2.20.04.99
  • preconditions :
    1.sharding table:create table test_shard(id int,c varchar);
    2.'select ...having' then there's the 'or' condition
  • configs:

schema.xml

<schema name="schema1" dataNode="dn5">
        <table name="test_shard" dataNode="dn1,dn2,dn3,dn4" rule="hash-four"/>
    </schema>

rule.xml

no

server.xml


  • steps:
    step1. select id,c from test_shard group by c having id<=1 or c = 'bb';
    step2. explain select id,c from test_shard group by c having id<=1 or c = 'bb';
  • expect result:
    1. similar to mysql: ERROR 1055 (42000): Expression Auto-increment column generates same values with global sequence #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'db_1.test_shard.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
+-------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DATA_NODE         | TYPE            | SQL/REF                                                                                                                                                                        |
+-------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| dn1_0             | BASE SQL        | select `test_shard`.`id`,`test_shard`.`c` from  `test_shard` where (`test_shard`.`id` <= 1) OR (`test_shard`.`c` = 9) GROUP BY `test_shard`.`c` ORDER BY `test_shard`.`c` ASC |
| dn2_0             | BASE SQL        | select `test_shard`.`id`,`test_shard`.`c` from  `test_shard` where (`test_shard`.`id` <= 1) OR (`test_shard`.`c` = 9) GROUP BY `test_shard`.`c` ORDER BY `test_shard`.`c` ASC |
| dn3_0             | BASE SQL        | select `test_shard`.`id`,`test_shard`.`c` from  `test_shard` where (`test_shard`.`id` <= 1) OR (`test_shard`.`c` = 9) GROUP BY `test_shard`.`c` ORDER BY `test_shard`.`c` ASC |
| dn4_0             | BASE SQL        | select `test_shard`.`id`,`test_shard`.`c` from  `test_shard` where (`test_shard`.`id` <= 1) OR (`test_shard`.`c` = 9) GROUP BY `test_shard`.`c` ORDER BY `test_shard`.`c` ASC |
| merge_and_order_1 | MERGE_AND_ORDER | dn1_0; dn2_0; dn3_0; dn4_0                                                                                                                                                     |
| aggregate_1       | AGGREGATE       | merge_and_order_1                                                                                                                                                              |
| shuffle_field_1   | SHUFFLE_FIELD   | aggregate_1                                                                                                                                                                    |
+-------------------+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  • real result:
    1. ERROR 1105 (HY000): java.lang.NullPointerException
    2. ERROR 1105 (HY000): java.lang.NullPointerException
error message:

2020-09-23 16:47:40,415 [DEBUG][BusinessExecutor2] ServerConnection [frontId=1, schema=schema1, host=10.186.60.28, user=test,txIsolation=3, autocommit=true, schema=schema1]select id,c from test_shard group by c having id<=1 or c = 'ee', route={
} rrs   (com.actiontech.dble.server.NonBlockingSession:NonBlockingSession.java:447) 
2020-09-23 16:47:40,419 [INFO ][BusinessExecutor2] Maybe occur a bug, please check it. java.lang.NullPointerException
	at com.actiontech.dble.plan.common.item.ItemField.fieldType(ItemField.java:91)
	at com.actiontech.dble.plan.common.item.Item.isTemporalWithDate(Item.java:440)
	at com.actiontech.dble.plan.common.item.function.operator.cmpfunc.util.ArgComparator.canCompareAsDates(ArgComparator.java:227)
	at com.actiontech.dble.plan.common.item.function.operator.cmpfunc.util.ArgComparator.setCmpFunc(ArgComparator.java:147)
	at com.actiontech.dble.plan.common.item.function.operator.cmpfunc.util.ArgComparator.setCmpFunc(ArgComparator.java:175)
	at com.actiontech.dble.plan.common.item.function.operator.ItemBoolFunc2.setCmpFunc(ItemBoolFunc2.java:25)
	at com.actiontech.dble.plan.common.item.function.operator.ItemBoolFunc2.fixLengthAndDec(ItemBoolFunc2.java:49)
	at com.actiontech.dble.plan.common.item.function.ItemFunc.fixFields(ItemFunc.java:100)
	at com.actiontech.dble.plan.common.item.function.ItemFunc.fixFields(ItemFunc.java:90)
	at com.actiontech.dble.plan.common.item.Item.canValued(Item.java:975)
	at com.actiontech.dble.plan.optimizer.FilterPreProcessor.shortestFilter(FilterPreProcessor.java:73)
	at com.actiontech.dble.plan.optimizer.FilterPreProcessor.shortestFilter(FilterPreProcessor.java:82)
	at com.actiontech.dble.plan.optimizer.FilterPreProcessor.processFilter(FilterPreProcessor.java:61)
	at com.actiontech.dble.plan.optimizer.FilterPreProcessor.preProcess(FilterPreProcessor.java:42)
	at com.actiontech.dble.plan.optimizer.FilterPreProcessor.optimize(FilterPreProcessor.java:35)
	at com.actiontech.dble.plan.optimizer.MyOptimizer.optimize(MyOptimizer.java:44)
	at com.actiontech.dble.server.NonBlockingSession.executeMultiSelect(NonBlockingSession.java:626)
	at com.actiontech.dble.server.NonBlockingSession.execute(NonBlockingSession.java:463)
	at com.actiontech.dble.server.ServerConnection.routeEndExecuteSQL(ServerConnection.java:374)
	at com.actiontech.dble.server.ServerConnection.execute(ServerConnection.java:312)
	at com.actiontech.dble.server.handler.SelectHandler.handle(SelectHandler.java:111)
	at com.actiontech.dble.server.ServerQueryHandler.query(ServerQueryHandler.java:101)
	at com.actiontech.dble.net.FrontendConnection.query(FrontendConnection.java:345)
	at com.actiontech.dble.net.FrontendConnection.query(FrontendConnection.java:364)
	at com.actiontech.dble.net.handler.FrontendCommandHandler.handleData(FrontendCommandHandler.java:127)
	at com.actiontech.dble.net.handler.FrontendCommandHandler.handle(FrontendCommandHandler.java:100)
	at com.actiontech.dble.net.handler.FrontEndHandlerRunnable.run(FrontEndHandlerRunnable.java:40)
	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)
 (com.actiontech.dble.net.handler.FrontendCommandHandler:FrontendCommandHandler.java:104) 

  • supplements:
    1.

Metadata

Metadata

Assignees

Labels

autotest-addedthe case has append to autotest

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions