Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
82490f14
Commit
82490f14
authored
May 23, 2005
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
parents
d68a5237
e3b06430
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1370 additions
and
509 deletions
+1370
-509
mysql-test/r/ndb_condition_pushdown.result
mysql-test/r/ndb_condition_pushdown.result
+314
-1
mysql-test/t/ndb_condition_pushdown.test
mysql-test/t/ndb_condition_pushdown.test
+298
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+722
-504
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+33
-3
sql/sql_select.cc
sql/sql_select.cc
+3
-1
No files found.
mysql-test/r/ndb_condition_pushdown.result
View file @
82490f14
...
...
@@ -251,6 +251,108 @@ auto
1
3
4
select auto from t1 where
(string between "aaaa" and "cccc") and
(vstring between "aaaa" and "cccc") and
(bin between 0xAAAA and 0xCCCC) and
(vbin between 0xAAAA and 0xCCCC) and
(tiny between -3 and -1) and
(short between -3 and -1) and
(medium between -3 and -1) and
(long_int between -3 and -1) and
(longlong between -3 and -1) and
(utiny between 1 and 3) and
(ushort between 1 and 3) and
(umedium between 1 and 3) and
(ulong between 1 and 3) and
(ulonglong between 1 and 3) and
(bits between b'001' and b'011') and
(options between 'one' and 'three') and
(flags between 'one' and 'one,two,three') and
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
auto
1
3
select auto from t1 where
("aaaa" between string and string) and
("aaaa" between vstring and vstring) and
(0xAAAA between bin and bin) and
(0xAAAA between vbin and vbin) and
(-1 between tiny and tiny) and
(-1 between short and short) and
(-1 between medium and medium) and
(-1 between long_int and long_int) and
(-1 between longlong and longlong) and
(1 between utiny and utiny) and
(1 between ushort and ushort) and
(1 between umedium and umedium) and
(1 between ulong and ulong) and
(1 between ulonglong and ulonglong) and
(b'001' between bits and bits) and
('one' between options and options) and
('one' between flags and flags) and
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and
('1901-01-01 01:01:01' between date_time and date_time)
order by auto;
auto
1
select auto from t1 where
string in("aaaa","cccc") and
vstring in("aaaa","cccc") and
bin in(0xAAAA,0xCCCC) and
vbin in(0xAAAA,0xCCCC) and
tiny in(-1,-3) and
short in(-1,-3) and
medium in(-1,-3) and
long_int in(-1,-3) and
longlong in(-1,-3) and
utiny in(1,3) and
ushort in(1,3) and
umedium in(1,3) and
ulong in(1,3) and
ulonglong in(1,3) and
bits in(b'001',b'011') and
options in('one','three') and
flags in('one','one,two,three') and
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
auto
1
3
select auto from t1 where
"aaaa" in(string) and
"aaaa" in(vstring) and
0xAAAA in(bin) and
0xAAAA in(vbin) and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1 in(utiny) and
1 in(ushort) and
1 in(umedium) and
1 in(ulong) and
1 in(ulonglong) and
b'001' in(bits) and
'one' in(options) and
'one' in(flags) and
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and
'1901-01-01 01:01:01' in(date_time)
order by auto;
auto
1
select * from t2 where attr3 is null or attr1 > 2 and pk1= 3 order by pk1;
pk1 attr1 attr2 attr3
2 2 NULL NULL
...
...
@@ -1023,6 +1125,212 @@ auto
1
3
4
explain
select auto from t1 where
(string between "aaaa" and "cccc") and
(vstring between "aaaa" and "cccc") and
(bin between 0xAAAA and 0xCCCC) and
(vbin between 0xAAAA and 0xCCCC) and
(tiny between -3 and -1) and
(short between -3 and -1) and
(medium between -3 and -1) and
(long_int between -3 and -1) and
(longlong between -3 and -1) and
(utiny between 1 and 3) and
(ushort between 1 and 3) and
(umedium between 1 and 3) and
(ulong between 1 and 3) and
(ulonglong between 1 and 3) and
/* (bits between b'001' and b'011') and */
(options between 'one' and 'three') and
(flags between 'one' and 'one,two,three') and
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range medium_index medium_index 3 NULL 10 Using where with pushed condition; Using filesort
select auto from t1 where
(string between "aaaa" and "cccc") and
(vstring between "aaaa" and "cccc") and
(bin between 0xAAAA and 0xCCCC) and
(vbin between 0xAAAA and 0xCCCC) and
(tiny between -3 and -1) and
(short between -3 and -1) and
(medium between -3 and -1) and
(long_int between -3 and -1) and
(longlong between -3 and -1) and
(utiny between 1 and 3) and
(ushort between 1 and 3) and
(umedium between 1 and 3) and
(ulong between 1 and 3) and
(ulonglong between 1 and 3) and
/* (bits between b'001' and b'011') and */
(options between 'one' and 'three') and
(flags between 'one' and 'one,two,three') and
(date_field between '1901-01-01' and '1903-03-03') and
(year_field between '1901' and '1903') and
(time_field between '01:01:01' and '03:03:03') and
(date_time between '1901-01-01 01:01:01' and '1903-03-03 03:03:03')
order by auto;
auto
1
3
explain
select auto from t1 where
("aaaa" between string and string) and
("aaaa" between vstring and vstring) and
(0xAAAA between bin and bin) and
(0xAAAA between vbin and vbin) and
(-1 between tiny and tiny) and
(-1 between short and short) and
(-1 between medium and medium) and
(-1 between long_int and long_int) and
(-1 between longlong and longlong) and
(1 between utiny and utiny) and
(1 between ushort and ushort) and
(1 between umedium and umedium) and
(1 between ulong and ulong) and
(1 between ulonglong and ulonglong) and
/* (b'001' between bits and bits) and */
('one' between options and options) and
('one' between flags and flags) and
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and
('1901-01-01 01:01:01' between date_time and date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
select auto from t1 where
("aaaa" between string and string) and
("aaaa" between vstring and vstring) and
(0xAAAA between bin and bin) and
(0xAAAA between vbin and vbin) and
(-1 between tiny and tiny) and
(-1 between short and short) and
(-1 between medium and medium) and
(-1 between long_int and long_int) and
(-1 between longlong and longlong) and
(1 between utiny and utiny) and
(1 between ushort and ushort) and
(1 between umedium and umedium) and
(1 between ulong and ulong) and
(1 between ulonglong and ulonglong) and
/* (b'001' between bits and bits) and */
('one' between options and options) and
('one' between flags and flags) and
('1901-01-01' between date_field and date_field) and
('1901' between year_field and year_field) and
('01:01:01' between time_field and time_field) and
('1901-01-01 01:01:01' between date_time and date_time)
order by auto;
auto
1
explain
select auto from t1 where
string in("aaaa","cccc") and
vstring in("aaaa","cccc") and
bin in(0xAAAA,0xCCCC) and
vbin in(0xAAAA,0xCCCC) and
tiny in(-1,-3) and
short in(-1,-3) and
medium in(-1,-3) and
long_int in(-1,-3) and
longlong in(-1,-3) and
utiny in(1,3) and
ushort in(1,3) and
umedium in(1,3) and
ulong in(1,3) and
ulonglong in(1,3) and
/* bits in(b'001',b'011') and */
options in('one','three') and
flags in('one','one,two,three') and
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range medium_index medium_index 3 NULL 20 Using where with pushed condition; Using filesort
select auto from t1 where
string in("aaaa","cccc") and
vstring in("aaaa","cccc") and
bin in(0xAAAA,0xCCCC) and
vbin in(0xAAAA,0xCCCC) and
tiny in(-1,-3) and
short in(-1,-3) and
medium in(-1,-3) and
long_int in(-1,-3) and
longlong in(-1,-3) and
utiny in(1,3) and
ushort in(1,3) and
umedium in(1,3) and
ulong in(1,3) and
ulonglong in(1,3) and
/* bits in(b'001',b'011') and */
options in('one','three') and
flags in('one','one,two,three') and
date_field in('1901-01-01','1903-03-03') and
year_field in('1901','1903') and
time_field in('01:01:01','03:03:03') and
date_time in('1901-01-01 01:01:01','1903-03-03 03:03:03')
order by auto;
auto
1
3
explain
select auto from t1 where
"aaaa" in(string) and
"aaaa" in(vstring) and
0xAAAA in(bin) and
0xAAAA in(vbin) and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1 in(utiny) and
1 in(ushort) and
1 in(umedium) and
1 in(ulong) and
1 in(ulonglong) and
/* b'001' in(bits) and */
'one' in(options) and
'one' in(flags) and
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and
'1901-01-01 01:01:01' in(date_time)
order by auto;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where with pushed condition; Using filesort
select auto from t1 where
"aaaa" in(string) and
"aaaa" in(vstring) and
0xAAAA in(bin) and
0xAAAA in(vbin) and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1 in(utiny) and
1 in(ushort) and
1 in(umedium) and
1 in(ulong) and
1 in(ulonglong) and
/* b'001' in(bits) and */
'one' in(options) and
'one' in(flags) and
'1901-01-01' in(date_field) and
'1901' in(year_field) and
'01:01:01' in(time_field) and
'1901-01-01 01:01:01' in(date_time)
order by auto;
auto
1
update t1
set medium = 17
where
...
...
@@ -1138,6 +1446,11 @@ id select_type table type possible_keys key key_len ref rows Extra
explain
select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 6 Using where with pushed condition; Using filesort
explain
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t4 ALL NULL NULL NULL NULL 6 Using where
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4;
mysql-test/t/ndb_condition_pushdown.test
View file @
82490f14
...
...
@@ -249,6 +249,104 @@ bin not like concat(0xBB, '%') and
vbin
not
like
concat
(
0xBB
,
'%'
)
order
by
auto
;
# BETWEEN
select
auto
from
t1
where
(
string
between
"aaaa"
and
"cccc"
)
and
(
vstring
between
"aaaa"
and
"cccc"
)
and
(
bin
between
0xAAAA
and
0xCCCC
)
and
(
vbin
between
0xAAAA
and
0xCCCC
)
and
(
tiny
between
-
3
and
-
1
)
and
(
short
between
-
3
and
-
1
)
and
(
medium
between
-
3
and
-
1
)
and
(
long_int
between
-
3
and
-
1
)
and
(
longlong
between
-
3
and
-
1
)
and
(
utiny
between
1
and
3
)
and
(
ushort
between
1
and
3
)
and
(
umedium
between
1
and
3
)
and
(
ulong
between
1
and
3
)
and
(
ulonglong
between
1
and
3
)
and
(
bits
between
b
'001'
and
b
'011'
)
and
(
options
between
'one'
and
'three'
)
and
(
flags
between
'one'
and
'one,two,three'
)
and
(
date_field
between
'1901-01-01'
and
'1903-03-03'
)
and
(
year_field
between
'1901'
and
'1903'
)
and
(
time_field
between
'01:01:01'
and
'03:03:03'
)
and
(
date_time
between
'1901-01-01 01:01:01'
and
'1903-03-03 03:03:03'
)
order
by
auto
;
select
auto
from
t1
where
(
"aaaa"
between
string
and
string
)
and
(
"aaaa"
between
vstring
and
vstring
)
and
(
0xAAAA
between
bin
and
bin
)
and
(
0xAAAA
between
vbin
and
vbin
)
and
(
-
1
between
tiny
and
tiny
)
and
(
-
1
between
short
and
short
)
and
(
-
1
between
medium
and
medium
)
and
(
-
1
between
long_int
and
long_int
)
and
(
-
1
between
longlong
and
longlong
)
and
(
1
between
utiny
and
utiny
)
and
(
1
between
ushort
and
ushort
)
and
(
1
between
umedium
and
umedium
)
and
(
1
between
ulong
and
ulong
)
and
(
1
between
ulonglong
and
ulonglong
)
and
(
b
'001'
between
bits
and
bits
)
and
(
'one'
between
options
and
options
)
and
(
'one'
between
flags
and
flags
)
and
(
'1901-01-01'
between
date_field
and
date_field
)
and
(
'1901'
between
year_field
and
year_field
)
and
(
'01:01:01'
between
time_field
and
time_field
)
and
(
'1901-01-01 01:01:01'
between
date_time
and
date_time
)
order
by
auto
;
# IN
select
auto
from
t1
where
string
in
(
"aaaa"
,
"cccc"
)
and
vstring
in
(
"aaaa"
,
"cccc"
)
and
bin
in
(
0xAAAA
,
0xCCCC
)
and
vbin
in
(
0xAAAA
,
0xCCCC
)
and
tiny
in
(
-
1
,
-
3
)
and
short
in
(
-
1
,
-
3
)
and
medium
in
(
-
1
,
-
3
)
and
long_int
in
(
-
1
,
-
3
)
and
longlong
in
(
-
1
,
-
3
)
and
utiny
in
(
1
,
3
)
and
ushort
in
(
1
,
3
)
and
umedium
in
(
1
,
3
)
and
ulong
in
(
1
,
3
)
and
ulonglong
in
(
1
,
3
)
and
bits
in
(
b
'001'
,
b
'011'
)
and
options
in
(
'one'
,
'three'
)
and
flags
in
(
'one'
,
'one,two,three'
)
and
date_field
in
(
'1901-01-01'
,
'1903-03-03'
)
and
year_field
in
(
'1901'
,
'1903'
)
and
time_field
in
(
'01:01:01'
,
'03:03:03'
)
and
date_time
in
(
'1901-01-01 01:01:01'
,
'1903-03-03 03:03:03'
)
order
by
auto
;
select
auto
from
t1
where
"aaaa"
in
(
string
)
and
"aaaa"
in
(
vstring
)
and
0xAAAA
in
(
bin
)
and
0xAAAA
in
(
vbin
)
and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1
in
(
utiny
)
and
1
in
(
ushort
)
and
1
in
(
umedium
)
and
1
in
(
ulong
)
and
1
in
(
ulonglong
)
and
b
'001'
in
(
bits
)
and
'one'
in
(
options
)
and
'one'
in
(
flags
)
and
'1901-01-01'
in
(
date_field
)
and
'1901'
in
(
year_field
)
and
'01:01:01'
in
(
time_field
)
and
'1901-01-01 01:01:01'
in
(
date_time
)
order
by
auto
;
# Various tests
select
*
from
t2
where
attr3
is
null
or
attr1
>
2
and
pk1
=
3
order
by
pk1
;
select
*
from
t2
where
attr3
is
not
null
and
attr1
>
2
order
by
pk1
;
...
...
@@ -955,6 +1053,204 @@ bin not like concat(0xBB, '%') and
vbin
not
like
concat
(
0xBB
,
'%'
)
order
by
auto
;
# BETWEEN
explain
select
auto
from
t1
where
(
string
between
"aaaa"
and
"cccc"
)
and
(
vstring
between
"aaaa"
and
"cccc"
)
and
(
bin
between
0xAAAA
and
0xCCCC
)
and
(
vbin
between
0xAAAA
and
0xCCCC
)
and
(
tiny
between
-
3
and
-
1
)
and
(
short
between
-
3
and
-
1
)
and
(
medium
between
-
3
and
-
1
)
and
(
long_int
between
-
3
and
-
1
)
and
(
longlong
between
-
3
and
-
1
)
and
(
utiny
between
1
and
3
)
and
(
ushort
between
1
and
3
)
and
(
umedium
between
1
and
3
)
and
(
ulong
between
1
and
3
)
and
(
ulonglong
between
1
and
3
)
and
/* (bits between b'001' and b'011') and */
(
options
between
'one'
and
'three'
)
and
(
flags
between
'one'
and
'one,two,three'
)
and
(
date_field
between
'1901-01-01'
and
'1903-03-03'
)
and
(
year_field
between
'1901'
and
'1903'
)
and
(
time_field
between
'01:01:01'
and
'03:03:03'
)
and
(
date_time
between
'1901-01-01 01:01:01'
and
'1903-03-03 03:03:03'
)
order
by
auto
;
select
auto
from
t1
where
(
string
between
"aaaa"
and
"cccc"
)
and
(
vstring
between
"aaaa"
and
"cccc"
)
and
(
bin
between
0xAAAA
and
0xCCCC
)
and
(
vbin
between
0xAAAA
and
0xCCCC
)
and
(
tiny
between
-
3
and
-
1
)
and
(
short
between
-
3
and
-
1
)
and
(
medium
between
-
3
and
-
1
)
and
(
long_int
between
-
3
and
-
1
)
and
(
longlong
between
-
3
and
-
1
)
and
(
utiny
between
1
and
3
)
and
(
ushort
between
1
and
3
)
and
(
umedium
between
1
and
3
)
and
(
ulong
between
1
and
3
)
and
(
ulonglong
between
1
and
3
)
and
/* (bits between b'001' and b'011') and */
(
options
between
'one'
and
'three'
)
and
(
flags
between
'one'
and
'one,two,three'
)
and
(
date_field
between
'1901-01-01'
and
'1903-03-03'
)
and
(
year_field
between
'1901'
and
'1903'
)
and
(
time_field
between
'01:01:01'
and
'03:03:03'
)
and
(
date_time
between
'1901-01-01 01:01:01'
and
'1903-03-03 03:03:03'
)
order
by
auto
;
explain
select
auto
from
t1
where
(
"aaaa"
between
string
and
string
)
and
(
"aaaa"
between
vstring
and
vstring
)
and
(
0xAAAA
between
bin
and
bin
)
and
(
0xAAAA
between
vbin
and
vbin
)
and
(
-
1
between
tiny
and
tiny
)
and
(
-
1
between
short
and
short
)
and
(
-
1
between
medium
and
medium
)
and
(
-
1
between
long_int
and
long_int
)
and
(
-
1
between
longlong
and
longlong
)
and
(
1
between
utiny
and
utiny
)
and
(
1
between
ushort
and
ushort
)
and
(
1
between
umedium
and
umedium
)
and
(
1
between
ulong
and
ulong
)
and
(
1
between
ulonglong
and
ulonglong
)
and
/* (b'001' between bits and bits) and */
(
'one'
between
options
and
options
)
and
(
'one'
between
flags
and
flags
)
and
(
'1901-01-01'
between
date_field
and
date_field
)
and
(
'1901'
between
year_field
and
year_field
)
and
(
'01:01:01'
between
time_field
and
time_field
)
and
(
'1901-01-01 01:01:01'
between
date_time
and
date_time
)
order
by
auto
;
select
auto
from
t1
where
(
"aaaa"
between
string
and
string
)
and
(
"aaaa"
between
vstring
and
vstring
)
and
(
0xAAAA
between
bin
and
bin
)
and
(
0xAAAA
between
vbin
and
vbin
)
and
(
-
1
between
tiny
and
tiny
)
and
(
-
1
between
short
and
short
)
and
(
-
1
between
medium
and
medium
)
and
(
-
1
between
long_int
and
long_int
)
and
(
-
1
between
longlong
and
longlong
)
and
(
1
between
utiny
and
utiny
)
and
(
1
between
ushort
and
ushort
)
and
(
1
between
umedium
and
umedium
)
and
(
1
between
ulong
and
ulong
)
and
(
1
between
ulonglong
and
ulonglong
)
and
/* (b'001' between bits and bits) and */
(
'one'
between
options
and
options
)
and
(
'one'
between
flags
and
flags
)
and
(
'1901-01-01'
between
date_field
and
date_field
)
and
(
'1901'
between
year_field
and
year_field
)
and
(
'01:01:01'
between
time_field
and
time_field
)
and
(
'1901-01-01 01:01:01'
between
date_time
and
date_time
)
order
by
auto
;
# IN
explain
select
auto
from
t1
where
string
in
(
"aaaa"
,
"cccc"
)
and
vstring
in
(
"aaaa"
,
"cccc"
)
and
bin
in
(
0xAAAA
,
0xCCCC
)
and
vbin
in
(
0xAAAA
,
0xCCCC
)
and
tiny
in
(
-
1
,
-
3
)
and
short
in
(
-
1
,
-
3
)
and
medium
in
(
-
1
,
-
3
)
and
long_int
in
(
-
1
,
-
3
)
and
longlong
in
(
-
1
,
-
3
)
and
utiny
in
(
1
,
3
)
and
ushort
in
(
1
,
3
)
and
umedium
in
(
1
,
3
)
and
ulong
in
(
1
,
3
)
and
ulonglong
in
(
1
,
3
)
and
/* bits in(b'001',b'011') and */
options
in
(
'one'
,
'three'
)
and
flags
in
(
'one'
,
'one,two,three'
)
and
date_field
in
(
'1901-01-01'
,
'1903-03-03'
)
and
year_field
in
(
'1901'
,
'1903'
)
and
time_field
in
(
'01:01:01'
,
'03:03:03'
)
and
date_time
in
(
'1901-01-01 01:01:01'
,
'1903-03-03 03:03:03'
)
order
by
auto
;
select
auto
from
t1
where
string
in
(
"aaaa"
,
"cccc"
)
and
vstring
in
(
"aaaa"
,
"cccc"
)
and
bin
in
(
0xAAAA
,
0xCCCC
)
and
vbin
in
(
0xAAAA
,
0xCCCC
)
and
tiny
in
(
-
1
,
-
3
)
and
short
in
(
-
1
,
-
3
)
and
medium
in
(
-
1
,
-
3
)
and
long_int
in
(
-
1
,
-
3
)
and
longlong
in
(
-
1
,
-
3
)
and
utiny
in
(
1
,
3
)
and
ushort
in
(
1
,
3
)
and
umedium
in
(
1
,
3
)
and
ulong
in
(
1
,
3
)
and
ulonglong
in
(
1
,
3
)
and
/* bits in(b'001',b'011') and */
options
in
(
'one'
,
'three'
)
and
flags
in
(
'one'
,
'one,two,three'
)
and
date_field
in
(
'1901-01-01'
,
'1903-03-03'
)
and
year_field
in
(
'1901'
,
'1903'
)
and
time_field
in
(
'01:01:01'
,
'03:03:03'
)
and
date_time
in
(
'1901-01-01 01:01:01'
,
'1903-03-03 03:03:03'
)
order
by
auto
;
explain
select
auto
from
t1
where
"aaaa"
in
(
string
)
and
"aaaa"
in
(
vstring
)
and
0xAAAA
in
(
bin
)
and
0xAAAA
in
(
vbin
)
and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1
in
(
utiny
)
and
1
in
(
ushort
)
and
1
in
(
umedium
)
and
1
in
(
ulong
)
and
1
in
(
ulonglong
)
and
/* b'001' in(bits) and */
'one'
in
(
options
)
and
'one'
in
(
flags
)
and
'1901-01-01'
in
(
date_field
)
and
'1901'
in
(
year_field
)
and
'01:01:01'
in
(
time_field
)
and
'1901-01-01 01:01:01'
in
(
date_time
)
order
by
auto
;
select
auto
from
t1
where
"aaaa"
in
(
string
)
and
"aaaa"
in
(
vstring
)
and
0xAAAA
in
(
bin
)
and
0xAAAA
in
(
vbin
)
and
/* -1 in(tiny) and */
/* -1 in (short) and */
/* -1 in(medium) and */
/* -1 in(long_int) and */
/* -1 in(longlong) and */
1
in
(
utiny
)
and
1
in
(
ushort
)
and
1
in
(
umedium
)
and
1
in
(
ulong
)
and
1
in
(
ulonglong
)
and
/* b'001' in(bits) and */
'one'
in
(
options
)
and
'one'
in
(
flags
)
and
'1901-01-01'
in
(
date_field
)
and
'1901'
in
(
year_field
)
and
'01:01:01'
in
(
time_field
)
and
'1901-01-01 01:01:01'
in
(
date_time
)
order
by
auto
;
# Update test
update
t1
set
medium
=
17
...
...
@@ -1044,6 +1340,8 @@ explain
select
auto
from
t1
where
string
=
"aaaa"
collate
latin1_general_ci
order
by
auto
;
explain
select
*
from
t2
where
(
attr1
<
2
)
=
(
attr2
<
2
)
order
by
pk1
;
explain
select
*
from
t3
left
join
t4
on
t4
.
attr2
=
t3
.
attr2
where
t4
.
attr1
>
1
and
t4
.
attr3
<
5
or
t4
.
attr1
is
null
order
by
t4
.
pk1
;
set
engine_condition_pushdown
=
@
old_ecpd
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
sql/ha_ndbcluster.cc
View file @
82490f14
...
...
@@ -6177,6 +6177,77 @@ void ndb_serialize_cond(const Item *item, void *arg)
}
if
(
context
->
supported
)
{
Ndb_rewrite_context
*
rewrite_context
=
context
->
rewrite_stack
;
const
Item_func
*
func_item
;
// Check if we are rewriting some unsupported function call
if
(
rewrite_context
&&
(
func_item
=
rewrite_context
->
func_item
)
&&
rewrite_context
->
count
++
==
0
)
{
switch
(
func_item
->
functype
())
{
case
(
Item_func
:
:
BETWEEN
)
:
/*
Rewrite
<field>|<const> BETWEEN <const1>|<field1> AND <const2>|<field2>
to <field>|<const> > <const1>|<field1> AND
<field>|<const> < <const2>|<field2>
or actually in prefix format
BEGIN(AND) GT(<field>|<const>, <const1>|<field1>),
LT(<field>|<const>, <const2>|<field2>), END()
*/
case
(
Item_func
:
:
IN_FUNC
)
:
{
/*
Rewrite <field>|<const> IN(<const1>|<field1>, <const2>|<field2>,..)
to <field>|<const> = <const1>|<field1> OR
<field> = <const2>|<field2> ...
or actually in prefix format
BEGIN(OR) EQ(<field>|<const>, <const1><field1>),
EQ(<field>|<const>, <const2>|<field2>), ... END()
Each part of the disjunction is added for each call
to ndb_serialize_cond and end of rewrite statement
is wrapped in end of ndb_serialize_cond
*/
if
(
context
->
expecting
(
item
->
type
()))
{
// This is the <field>|<const> item, save it in the rewrite context
rewrite_context
->
left_hand_item
=
item
;
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
{
Item_func
*
func_item
=
(
Item_func
*
)
item
;
if
(
func_item
->
functype
()
==
Item_func
::
UNKNOWN_FUNC
&&
func_item
->
const_item
())
{
// Skip any arguments since we will evaluate function instead
DBUG_PRINT
(
"info"
,
(
"Skip until end of arguments marker"
));
context
->
skip
=
func_item
->
argument_count
();
}
else
{
DBUG_PRINT
(
"info"
,
(
"Found unsupported functional expression in BETWEEN|IN"
));
context
->
supported
=
FALSE
;
DBUG_VOID_RETURN
;
}
}
}
else
{
// Non-supported BETWEEN|IN expression
DBUG_PRINT
(
"info"
,
(
"Found unexpected item of type %u in BETWEEN|IN"
,
item
->
type
()));
context
->
supported
=
FALSE
;
DBUG_VOID_RETURN
;
}
break
;
}
default:
context
->
supported
=
FALSE
;
break
;
}
DBUG_VOID_RETURN
;
}
else
{
Ndb_cond_stack
*
ndb_stack
=
context
->
stack_ptr
;
Ndb_cond
*
prev_cond
=
context
->
cond_ptr
;
...
...
@@ -6185,6 +6256,83 @@ void ndb_serialize_cond(const Item *item, void *arg)
ndb_stack
->
ndb_cond
=
curr_cond
;
curr_cond
->
prev
=
prev_cond
;
if
(
prev_cond
)
prev_cond
->
next
=
curr_cond
;
// Check if we are rewriting some unsupported function call
if
(
context
->
rewrite_stack
)
{
Ndb_rewrite_context
*
rewrite_context
=
context
->
rewrite_stack
;
const
Item_func
*
func_item
=
rewrite_context
->
func_item
;
switch
(
func_item
->
functype
())
{
case
(
Item_func
:
:
BETWEEN
)
:
{
/*
Rewrite
<field>|<const> BETWEEN <const1>|<field1> AND <const2>|<field2>
to <field>|<const> > <const1>|<field1> AND
<field>|<const> < <const2>|<field2>
or actually in prefix format
BEGIN(AND) GT(<field>|<const>, <const1>|<field1>),
LT(<field>|<const>, <const2>|<field2>), END()
*/
if
(
rewrite_context
->
count
==
2
)
{
// Lower limit of BETWEEN
DBUG_PRINT
(
"info"
,
(
"GE_FUNC"
));
curr_cond
->
ndb_item
=
new
Ndb_item
(
Item_func
::
GE_FUNC
,
2
);
}
else
if
(
rewrite_context
->
count
==
3
)
{
// Upper limit of BETWEEN
DBUG_PRINT
(
"info"
,
(
"LE_FUNC"
));
curr_cond
->
ndb_item
=
new
Ndb_item
(
Item_func
::
LE_FUNC
,
2
);
}
else
{
// Illegal BETWEEN expression
DBUG_PRINT
(
"info"
,
(
"Illegal BETWEEN expression"
));
context
->
supported
=
FALSE
;
DBUG_VOID_RETURN
;
}
break
;
}
case
(
Item_func
:
:
IN_FUNC
)
:
{
/*
Rewrite <field>|<const> IN(<const1>|<field1>, <const2>|<field2>,..)
to <field>|<const> = <const1>|<field1> OR
<field> = <const2>|<field2> ...
or actually in prefix format
BEGIN(OR) EQ(<field>|<const>, <const1><field1>),
EQ(<field>|<const>, <const2>|<field2>), ... END()
Each part of the disjunction is added for each call
to ndb_serialize_cond and end of rewrite statement
is wrapped in end of ndb_serialize_cond
*/
DBUG_PRINT
(
"info"
,
(
"EQ_FUNC"
));
curr_cond
->
ndb_item
=
new
Ndb_item
(
Item_func
::
EQ_FUNC
,
2
);
break
;
}
default:
context
->
supported
=
FALSE
;
}
// Handle left hand <field>|<const>
context
->
rewrite_stack
=
NULL
;
// Disable rewrite mode
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect_field_result
(
STRING_RESULT
);
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
INT_ITEM
);
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
VARBIN_ITEM
);
context
->
expect
(
Item
::
FUNC_ITEM
);
ndb_serialize_cond
(
rewrite_context
->
left_hand_item
,
arg
);
context
->
skip
=
0
;
// Any FUNC_ITEM expression has already been parsed
context
->
rewrite_stack
=
rewrite_context
;
// Enable rewrite mode
if
(
!
context
->
supported
)
DBUG_VOID_RETURN
;
prev_cond
=
context
->
cond_ptr
;
curr_cond
=
context
->
cond_ptr
=
new
Ndb_cond
();
prev_cond
->
next
=
curr_cond
;
}
// Check for end of AND/OR expression
if
(
!
item
)
...
...
@@ -6213,16 +6361,16 @@ void ndb_serialize_cond(const Item *item, void *arg)
// Check that we are expecting a field and with the correct
// result type
if
(
context
->
expecting
(
Item
::
FIELD_ITEM
)
&&
if
(
context
->
expecting
(
Item
::
FIELD_ITEM
)
&&
(
context
->
expecting_field_result
(
field
->
result_type
())
||
// Date and year can be written as strings
(
type
==
MYSQL_TYPE_TIME
||
(
(
type
==
MYSQL_TYPE_TIME
||
type
==
MYSQL_TYPE_DATE
||
type
==
MYSQL_TYPE_YEAR
||
type
==
MYSQL_TYPE_DATETIME
)
?
context
->
expecting_field_result
(
STRING_RESULT
)
:
true
)
?
context
->
expecting_field_result
(
STRING_RESULT
)
:
true
))
&&
// Bit fields no yet supported in scan filter
&&
type
!=
MYSQL_TYPE_BIT
)
type
!=
MYSQL_TYPE_BIT
)
{
const
NDBCOL
*
col
=
tab
->
getColumn
(
field
->
field_name
);
DBUG_ASSERT
(
col
);
...
...
@@ -6271,7 +6419,11 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect
(
Item
::
COND_ITEM
);
// Check that field and string constant collations are the same
if
((
field
->
result_type
()
==
STRING_RESULT
)
&&
!
context
->
expecting_collation
(
item
->
collation
.
collation
))
!
context
->
expecting_collation
(
item
->
collation
.
collation
)
&&
type
!=
MYSQL_TYPE_TIME
&&
type
!=
MYSQL_TYPE_DATE
&&
type
!=
MYSQL_TYPE_YEAR
&&
type
!=
MYSQL_TYPE_DATETIME
)
{
DBUG_PRINT
(
"info"
,
(
"Found non-matching collation %s"
,
item
->
collation
.
collation
->
name
));
...
...
@@ -6280,10 +6432,20 @@ void ndb_serialize_cond(const Item *item, void *arg)
}
break
;
}
}
else
{
DBUG_PRINT
(
"info"
,
(
"Was not expecting field of type %u"
,
field
->
result_type
()));
context
->
supported
=
FALSE
;
}
}
else
{
DBUG_PRINT
(
"info"
,
(
"Was not expecting field from table %s(%s)"
,
context
->
table
->
s
->
table_name
,
field
->
table
->
s
->
table_name
));
context
->
supported
=
FALSE
;
}
break
;
}
case
(
Item
:
:
FUNC_ITEM
)
:
{
...
...
@@ -6314,6 +6476,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
NE_FUNC
)
:
{
...
...
@@ -6330,6 +6493,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
LT_FUNC
)
:
{
...
...
@@ -6346,6 +6510,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
LE_FUNC
)
:
{
...
...
@@ -6362,6 +6527,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
GE_FUNC
)
:
{
...
...
@@ -6378,6 +6544,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
GT_FUNC
)
:
{
...
...
@@ -6394,6 +6561,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect_field_result
(
REAL_RESULT
);
context
->
expect_field_result
(
INT_RESULT
);
context
->
expect_field_result
(
DECIMAL_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
LIKE_FUNC
)
:
{
...
...
@@ -6403,6 +6571,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
FIELD_ITEM
);
context
->
expect_field_result
(
STRING_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
NOTLIKE_FUNC
)
:
{
...
...
@@ -6412,6 +6581,7 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
FIELD_ITEM
);
context
->
expect_field_result
(
STRING_RESULT
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
ISNULL_FUNC
)
:
{
...
...
@@ -6444,6 +6614,38 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
expect
(
Item
::
COND_ITEM
);
break
;
}
case
(
Item_func
:
:
BETWEEN
)
:
{
DBUG_PRINT
(
"info"
,
(
"BETWEEN, rewriting using AND"
));
Ndb_rewrite_context
*
rewrite_context
=
new
Ndb_rewrite_context
(
func_item
);
rewrite_context
->
next
=
context
->
rewrite_stack
;
context
->
rewrite_stack
=
rewrite_context
;
DBUG_PRINT
(
"info"
,
(
"COND_AND_FUNC"
));
curr_cond
->
ndb_item
=
new
Ndb_item
(
Item_func
::
COND_AND_FUNC
,
func_item
->
argument_count
()
-
1
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect
(
Item
::
INT_ITEM
);
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
VARBIN_ITEM
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
IN_FUNC
)
:
{
DBUG_PRINT
(
"info"
,
(
"IN_FUNC, rewriting using OR"
));
Ndb_rewrite_context
*
rewrite_context
=
new
Ndb_rewrite_context
(
func_item
);
rewrite_context
->
next
=
context
->
rewrite_stack
;
context
->
rewrite_stack
=
rewrite_context
;
DBUG_PRINT
(
"info"
,
(
"COND_OR_FUNC"
));
curr_cond
->
ndb_item
=
new
Ndb_item
(
Item_func
::
COND_OR_FUNC
,
func_item
->
argument_count
()
-
1
);
context
->
expect_only
(
Item
::
FIELD_ITEM
);
context
->
expect
(
Item
::
INT_ITEM
);
context
->
expect
(
Item
::
STRING_ITEM
);
context
->
expect
(
Item
::
VARBIN_ITEM
);
context
->
expect
(
Item
::
FUNC_ITEM
);
break
;
}
case
(
Item_func
:
:
UNKNOWN_FUNC
)
:
{
DBUG_PRINT
(
"info"
,
(
"UNKNOWN_FUNC %s"
,
func_item
->
const_item
()
?
"const"
:
""
));
...
...
@@ -6653,14 +6855,6 @@ void ndb_serialize_cond(const Item *item, void *arg)
DBUG_PRINT
(
"info"
,
(
"VARBIN_ITEM"
));
if
(
context
->
expecting
(
Item
::
VARBIN_ITEM
))
{
#ifndef DBUG_OFF
char
buff
[
256
];
String
str
(
buff
,(
uint32
)
sizeof
(
buff
),
system_charset_info
);
str
.
length
(
0
);
Item_hex_string
*
varbin_item
=
(
Item_hex_string
*
)
item
;
DBUG_PRINT
(
"info"
,
(
"value
\"
%s
\"
"
,
varbin_item
->
val_str
(
&
str
)
->
ptr
()));
#endif
NDB_ITEM_QUALIFICATION
q
;
q
.
value_type
=
Item
::
VARBIN_ITEM
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_VALUE
,
q
,
item
);
...
...
@@ -6736,6 +6930,24 @@ void ndb_serialize_cond(const Item *item, void *arg)
context
->
supported
=
FALSE
;
}
}
if
(
context
->
supported
&&
context
->
rewrite_stack
)
{
Ndb_rewrite_context
*
rewrite_context
=
context
->
rewrite_stack
;
if
(
rewrite_context
->
count
==
rewrite_context
->
func_item
->
argument_count
())
{
// Rewrite is done, wrap an END() at the en
DBUG_PRINT
(
"info"
,
(
"End of condition group"
));
prev_cond
=
curr_cond
;
curr_cond
=
context
->
cond_ptr
=
new
Ndb_cond
();
prev_cond
->
next
=
curr_cond
;
curr_cond
->
ndb_item
=
new
Ndb_item
(
NDB_END_COND
);
// Pop rewrite stack
context
->
rewrite_stack
=
context
->
rewrite_stack
->
next
;
}
}
}
}
DBUG_VOID_RETURN
;
...
...
@@ -7054,6 +7266,8 @@ ha_ndbcluster::build_scan_filter(Ndb_cond * &cond, NdbScanFilter *filter)
DBUG_ENTER
(
"build_scan_filter"
);
switch
(
cond
->
ndb_item
->
type
)
{
case
(
NDB_FUNCTION
):
switch
(
cond
->
ndb_item
->
qualification
.
function_type
)
{
case
(
Item_func
:
:
COND_AND_FUNC
)
:
case
(
Item_func
:
:
COND_OR_FUNC
)
:
simple_cond
=
FALSE
;
...
...
@@ -7061,6 +7275,10 @@ ha_ndbcluster::build_scan_filter(Ndb_cond * &cond, NdbScanFilter *filter)
default:
break
;
}
break
;
default:
break
;
}
if
(
simple_cond
&&
filter
->
begin
()
==
-
1
)
DBUG_RETURN
(
1
);
if
(
build_scan_filter_group
(
cond
,
filter
))
...
...
sql/ha_ndbcluster.h
View file @
82490f14
...
...
@@ -86,6 +86,7 @@ typedef struct ndb_item_field_value {
typedef
union
ndb_item_value
{
const
Item
*
item
;
NDB_ITEM_FIELD_VALUE
*
field_value
;
uint
arg_count
;
}
NDB_ITEM_VALUE
;
struct
negated_function_mapping
...
...
@@ -144,6 +145,7 @@ class Ndb_item {
}
case
(
NDB_FUNCTION
):
value
.
item
=
item_value
;
value
.
arg_count
=
((
Item_func
*
)
item_value
)
->
argument_count
();
break
;
case
(
NDB_END_COND
):
break
;
...
...
@@ -162,6 +164,13 @@ class Ndb_item {
{
qualification
.
function_type
=
func_type
;
value
.
item
=
item_value
;
value
.
arg_count
=
((
Item_func
*
)
item_value
)
->
argument_count
();
};
Ndb_item
(
Item_func
::
Functype
func_type
,
uint
no_args
)
:
type
(
NDB_FUNCTION
)
{
qualification
.
function_type
=
func_type
;
value
.
arg_count
=
no_args
;
};
~
Ndb_item
()
{
...
...
@@ -194,7 +203,7 @@ class Ndb_item {
int
argument_count
()
{
return
((
Item_func
*
)
value
.
item
)
->
argument_count
();
return
value
.
arg_count
;
};
const
char
*
get_val
()
...
...
@@ -273,12 +282,28 @@ class Ndb_cond_stack
{
if
(
ndb_cond
)
delete
ndb_cond
;
ndb_cond
=
NULL
;
if
(
next
)
delete
next
;
next
=
NULL
;
};
Ndb_cond
*
ndb_cond
;
Ndb_cond_stack
*
next
;
};
class
Ndb_rewrite_context
{
public:
Ndb_rewrite_context
(
Item_func
*
func
)
:
func_item
(
func
),
left_hand_item
(
NULL
),
count
(
0
)
{};
~
Ndb_rewrite_context
()
{
if
(
next
)
delete
next
;
}
const
Item_func
*
func_item
;
const
Item
*
left_hand_item
;
uint
count
;
Ndb_rewrite_context
*
next
;
};
/*
This class is used for storing the context when traversing
the Item tree. It stores a reference to the table the condition
...
...
@@ -292,11 +317,16 @@ class Ndb_cond_traverse_context
Ndb_cond_traverse_context
(
TABLE
*
tab
,
void
*
ndb_tab
,
Ndb_cond_stack
*
stack
)
:
table
(
tab
),
ndb_table
(
ndb_tab
),
supported
(
TRUE
),
stack_ptr
(
stack
),
cond_ptr
(
NULL
),
expect_mask
(
0
),
expect_field_result_mask
(
0
),
skip
(
0
),
collation
(
NULL
)
expect_mask
(
0
),
expect_field_result_mask
(
0
),
skip
(
0
),
collation
(
NULL
),
rewrite_stack
(
NULL
)
{
if
(
stack
)
cond_ptr
=
stack
->
ndb_cond
;
};
~
Ndb_cond_traverse_context
()
{
if
(
rewrite_stack
)
delete
rewrite_stack
;
}
void
expect
(
Item
::
Type
type
)
{
expect_mask
|=
(
1
<<
type
);
...
...
@@ -357,7 +387,7 @@ class Ndb_cond_traverse_context
uint
expect_field_result_mask
;
uint
skip
;
CHARSET_INFO
*
collation
;
Ndb_rewrite_context
*
rewrite_stack
;
};
/*
...
...
sql/sql_select.cc
View file @
82490f14
...
...
@@ -5461,10 +5461,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if
(
!
(
tmp
=
add_found_match_trig_cond
(
first_inner_tab
,
tmp
,
0
)))
DBUG_RETURN
(
1
);
tab
->
select_cond
=
sel
->
cond
=
tmp
;
/* Push condition to storage engine if this is enabled
and the condition is not guarded */
if
(
thd
->
variables
.
engine_condition_pushdown
)
{
COND
*
push_cond
=
make_cond_for_table
(
cond
,
current_map
,
current_map
);
make_cond_for_table
(
tmp
,
current_map
,
current_map
);
tab
->
table
->
file
->
pushed_cond
=
NULL
;
if
(
push_cond
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment