List:Commits« Previous MessageNext Message »
From:Ole John Aske Date:February 11 2011 1:16pm
Subject:bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch
(ole.john.aske:3431)
View as plain text  
#At file:///net/fimafeng09/export/home/tmp/oleja/mysql/mysql-5.1-telco-7.0-spj-scan-scan/ based on revid:ole.john.aske@stripped

 3431 Ole John Aske	2011-02-11
      SPJ-scan-scan: ::setInterpretedCode() as part of the NdbQueryDef instead of 
      setting it as part of each instantiated NdbQuery.

    modified:
      sql/ha_ndbcluster.cc
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-02-09 14:59:39 +0000
+++ b/sql/ha_ndbcluster.cc	2011-02-11 13:16:37 +0000
@@ -486,6 +486,16 @@ ha_ndbcluster::make_pushed_join(ndb_push
      */
     if (push_cnt == 0)
     {
+      NdbQueryOptions options;
+      if (m_cond)
+      {
+        NdbInterpretedCode code(m_table);
+        if (m_cond->generate_scan_filter(&code, NULL) != 0)
+          ERR_RETURN(code.getNdbError());
+
+        options.setInterpretedCode(code);
+      }
+
       if (ndbcluster_is_lookup_operation(access_type))
       {
         const KEY* const key= 
@@ -511,7 +521,7 @@ ha_ndbcluster::make_pushed_join(ndb_push
           DBUG_PRINT("info", ("Root operation is 'primary-key-lookup'"));
           DBUG_ASSERT(join_root->get_index_no() == 
                       static_cast<int>(table->s->primary_key));
-          query_op= builder->readTuple(m_table, root_key);
+          query_op= builder->readTuple(m_table, root_key, &options);
         }
         else
         {
@@ -519,7 +529,7 @@ ha_ndbcluster::make_pushed_join(ndb_push
           const NdbDictionary::Index* const index 
             = m_index[join_root->get_index_no()].unique_index;
           DBUG_ASSERT(index);
-          query_op= builder->readTuple(index, m_table, root_key);
+          query_op= builder->readTuple(index, m_table, root_key, &options);
         }
       }
       /**
@@ -542,12 +552,12 @@ ha_ndbcluster::make_pushed_join(ndb_push
 
         // Bounds will be generated and supplied during execute
         query_op= 
-          builder->scanIndex(m_index[join_root->get_index_no()].index, m_table);
+          builder->scanIndex(m_index[join_root->get_index_no()].index, m_table, 0, &options);
       }
       else if (access_type == AQP::AT_TABLE_SCAN) 
       {
         DBUG_PRINT("info", ("Root operation is 'table scan'"));
-        query_op= builder->scanTable(m_table);
+        query_op= builder->scanTable(m_table, &options);
       }
       else
       {
@@ -700,6 +710,14 @@ ha_ndbcluster::make_pushed_join(ndb_push
       DBUG_ASSERT(parent_op != NULL);
       options.setParent(parent_op);
     }
+    if (handler->m_cond)
+    {
+      NdbInterpretedCode code(table);
+      if (handler->m_cond->generate_scan_filter(&code, NULL) != 0)
+        ERR_RETURN(code.getNdbError());
+
+      options.setInterpretedCode(code);
+    }
 
     if (join_tab->get_access_type() == AQP::AT_ORDERED_INDEX_SCAN)
     {
@@ -721,7 +739,6 @@ ha_ndbcluster::make_pushed_join(ndb_push
       query_op= builder->readTuple(index, table, linked_key, &options);
     }
 
-//  DBUG_ASSERT(query_op);
     if (unlikely(!query_op))
     {
       const NdbError error = builder->getNdbError();
@@ -1019,7 +1036,6 @@ ha_ndbcluster::create_pushed_join(NdbQue
     ERR_RETURN(m_thd_ndb->trans->getNdbError());
 
   // Bind to instantiated NdbQueryOperations.
-  // Append filters for for pushed conditions where available
   for (uint i= 0; i < m_pushed_join->get_operation_count(); i++)
   {
     const TABLE* const tab= m_pushed_join->get_table(i);
@@ -1028,16 +1044,6 @@ ha_ndbcluster::create_pushed_join(NdbQue
     NdbQueryOperation* const op= query->getQueryOperation(i);
     handler->m_pushed_operation= op;
 
-    if (handler->m_cond)
-    {
-      NdbInterpretedCode code(handler->m_table);
-      if (handler->m_cond->generate_scan_filter(&code, NULL) != 0)
-        ERR_RETURN(code.getNdbError());
-
-      if (op->setInterpretedCode(code) != 0)
-        ERR_RETURN(query->getNdbError());
-    }
-
     // Bind to result buffers
     const NdbRecord* const resultRec= handler->m_ndb_record;
     int res= op->setResultRowRef(


Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20110211131637-zfb58opd4zlnnf5z.bundle
Thread
bzr commit into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3431) Ole John Aske11 Feb