How GemFire XD Invokes a RowLoader

GemFire XD only invokes a configured RowLoader when certain conditions are met.

GemFire XD invokes a configured RowLoader when:
  • A SELECT query is executed against a table with a WHERE clause that includes an equality (=) test for every component that is part of the table's primary key, and
  • A row for the specified primary key does not exist in memory.

Note that it does not matter which columns are requested or used from the resulting rows.

For example, consider the following example table definition:
CREATE TABLE LoaderTest(id INTEGER, name VARCHAR(10), result 
VARCHAR(10), primary key (id, name));
In the "LoaderTest" table, columns "id" and "name" form the primary key. Queries that use an equality test on the primary key invoke an attached loader implementation for the table, if the data was not already available in GemFire XD. For example, these queries would invoke a loader:
SELECT * FROM LoaderTest WHERE id = 5 AND name='Joe';
SELECT result FROM LoaderTest WHERE id = 6 AND name='Sam'; 
However, these queries would not invoke an attached loader:
SELECT result FROM LoaderTest WHERE id < 6 AND name='Sam'; 
SELECT * FROM LoaderTest; 
SELECT * FROM LoaderTest WHERE id = 5;
In the above examples, none of the SELECT statements use an equality test for all components of the primary key (both "id" and "name").