Hello Sergei, Thanks a lot for your response. I have tried to use that route but without success. The problem is that I can only access the last record read from table1. Let say that, during the JOIN, 3 rows are read from table1. These 3 rows will be compared against all rows from table2. I want to avoid a full scan of table2 by passing the value for the field from those 3 rows down to the storage engine. When condition pushdown is called on table2, and I try to access those 3 rows, I can only access the last one read through f1->field->ptr (or f1->table->record[0]). For what I understand, f1->table does not store an array of read records during JOIN. Am I right? That is stored in the JOIN_CACHE object. Please correct me if I am wrong here. Thanks again for your help, Eduardo Berrocal García de Carellán Senior Software Engineer Intel Corporation | intel.com -----Original Message----- From: Sergei Golubchik <serg@mariadb.org> Sent: Thursday, July 8, 2021 12:43 AM To: Berrocal, Eduardo <eduardo.berrocal@intel.com> Cc: maria-developers@lists.launchpad.net Subject: Re: [Maria-developers] Accessing read records during join for condition pushdown Hi, Berrocal,! On Jul 06, Berrocal, Eduardo wrote:
Hello list (first email here, hopefully sending it to the right address), I have been trying to solve this problem for a while now, and I am stuck. I wonder if what I am trying to do is even possible.
I am implementing a new storage engine which handles engine condition pushdown. Now, when MariaDB is working on a JOIN using more than one table (for simplicity, let's assume 2), how can I access the read records for table 1 when working on a condition pushdown for table 2? When joining like this: table1.field1 = table2.field1, I can see 2 Item objects of type FIELD in the condition. However, I can't find where the read records for table1 are so I can effectively filter records in table2 by those values.
if f1 is Item_field for table1.field1, then generally f1->field->table->record[0] is the current record for the table1, and f1->field->ptr is the pointer to the field1 value in that currect record
Thanks a lot for your help,
Eduardo Berrocal García de Carellán Senior Software Engineer Intel Corporation | intel.com<http://intel.com/>
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org