#At file:///export/home/tmp/oleja/mysql/mysql-5.1-telco-7.0-spj/ based on revid:ole.john.aske@stripped
3183 Ole John Aske 2010-06-22
Prevent prepared pushed joins to be instantiated & executed if any of
the parameter values are the NULL value.
modified:
mysql-test/suite/ndb/r/ndb_join_pushdown.result
mysql-test/suite/ndb/t/ndb_join_pushdown.test
sql/ha_ndbcluster.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-06-22 11:41:06 +0000
+++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result 2010-06-22 12:23:04 +0000
@@ -1882,6 +1882,12 @@ id select_type table type possible_keys
1 SIMPLE Y1 ref b3 b3 9 test.X1.b3,test.X1.d3 1 Child of pushed join@1; Using where
1 SIMPLE X2 ref b3,c3,c3_2 b3 4 test.X1.b3 1 Parent of 2 pushed join@2
1 SIMPLE Y2 ref b3 b3 9 test.X2.c3,test.X1.c3 1 Child of pushed join@2; Using where
+select straight_join * from
+t3 as X1
+JOIN t3 as Y1 on X1.b3 = Y1.b3 and X1.d3 = Y1.d3
+JOIN t3 as X2 on X2.b3 = Y1.b3
+JOIN t3 as Y2 on Y2.b3 = X2.c3 and Y2.d3 = X1.c3;
+a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3 a3 b3 c3 d3
drop table t3;
create table t1 (a int primary key, b int, c int, index(b,c)) engine = ndb;
insert into t1 values (1,null, 2);
=== modified file 'mysql-test/suite/ndb/t/ndb_join_pushdown.test'
--- a/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-06-22 11:41:06 +0000
+++ b/mysql-test/suite/ndb/t/ndb_join_pushdown.test 2010-06-22 12:23:04 +0000
@@ -1218,7 +1218,12 @@ select straight_join * from
JOIN t3 as Y1 on X1.b3 = Y1.b3 and X1.d3 = Y1.d3
JOIN t3 as X2 on X2.b3 = Y1.b3
JOIN t3 as Y2 on Y2.b3 = X2.c3 and Y2.d3 = X1.c3;
-
+--sorted_result
+select straight_join * from
+ t3 as X1
+ JOIN t3 as Y1 on X1.b3 = Y1.b3 and X1.d3 = Y1.d3
+ JOIN t3 as X2 on X2.b3 = Y1.b3
+ JOIN t3 as Y2 on Y2.b3 = X2.c3 and Y2.d3 = X1.c3;
drop table t3;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-06-22 12:02:49 +0000
+++ b/sql/ha_ndbcluster.cc 2010-06-22 12:23:04 +0000
@@ -1488,6 +1488,23 @@ ha_ndbcluster::check_if_pushable(const N
DBUG_ASSERT(false);
break;
}
+
+ if (likely(pushable))
+ {
+ // There may be referrences to Field values from tables outside the scope of
+ // our pushed join which are supplied as paramValues().
+ // If any of these are NULL values, join can't be pushed
+ for (uint i= 0; i < m_pushed_join->get_field_referrences_count(); i++)
+ {
+ Field* field= m_pushed_join->get_field_ref(i);
+ if (field->is_real_null())
+ {
+ DBUG_PRINT("info", ("paramValue is NULL, can not execute as pushed join"));
+ pushable= false;
+ break;
+ }
+ }
+ }
}
}
else
@@ -1536,7 +1553,7 @@ ha_ndbcluster::create_pushed_join(NdbQue
{
Field* field= m_pushed_join->get_field_ref(i);
bool shrinkVarChar= is_shrinked_varchar(field);
- DBUG_ASSERT(!field->is_real_null());
+ DBUG_ASSERT(!field->is_real_null()); // Checked by ::check_if_pushable()
paramValues[paramOffs+i]= NdbQueryParamValue(field->ptr, shrinkVarChar);
}
Attachment: [text/bzr-bundle] bzr/ole.john.aske@sun.com-20100622122304-krsqzp9dq7aosrs0.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0-spj branch (ole.john.aske:3183) | Ole John Aske | 22 Jun |