-- Recreate Semi Join Issue

INSTALL SONAME "ha_spider";

CREATE DATABASE spidertesta;

CREATE TABLE `spidertesta`.`testtable` (
  `TestNum` BIGINT(20) NOT NULL AUTO_INCREMENT,
  `ReadValue` BIGINT(20) DEFAULT 0,
  PRIMARY KEY (`TestNum`)
) ENGINE=MYISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;



CREATE DATABASE spidertestb;


CREATE TABLE `spidertestb`.`testtable` ENGINE=SPIDER COMMENT='srv "localspider"';

SET SESSION optimizer_switch='semijoin=on';

SELECT *
FROM spidertestb.testtable
WHERE TestNum BETWEEN 0 AND 10
AND ReadValue IN(SELECT ReadValue FROM spidertestb.testtable WHERE TestNum BETWEEN 11 AND 20)

SET SESSION optimizer_switch='semijoin=off';

SELECT *
FROM spidertestb.testtable
WHERE TestNum BETWEEN 0 AND 10
AND ReadValue IN(SELECT ReadValue FROM spidertestb.testtable WHERE TestNum BETWEEN 11 AND 20)

