Attaching d6003-4a-scanresultset.diff which removes the generated
methods that create row templates for the ScanResultSet tree. It
currently depends on the 3a patch in order to make the upgrade tests
There still are other result set classes that use generated methods to
produce row templates, so the code that generates the code is not
removed in this patch. I'll post other patches later to fix the rest
of the result set tree and remove the generated code.
This patch adds a new class, called ExecRowBuilder, which can be used
to produce and reset candidate rows used by the scan result sets. Its
build() method creates an instance of the correct sub-type of ExecRow
with SQL null values in the columns used by the scan. This is what was
previously done in the generated constructor for the activation. Its
reset() method replaces the existing values in the row with fresh
instances that represent SQL null of the correct type, which is the
same as the generated methods previously did.
Instead of passing a reference to the generated method into the
ScanResultSet constructor, the compiler now stores an ExecRowBuilder
in GenericPreparedStatement.savedObjects and passes the array index as
an argument to the constructor.
New class, as described above.
As mentioned in an earlier comment, DTD's deserialization wouldn't
fully restore the state of the original instance if it represented a
user-defined type. Fixed by using TypeId.getUserDefinedTypeId()
instead of TypeId.getBuiltInTypeId() if the type is user-defined.
This was needed in order to get ExecRowBuilder to deserialize
successfully when the query accessed UDTs.
Added a method buildRowTemplate() that creates an ExecRowBuilder of
the right shape. The logic is essentially the same as in the existing
ResultColumnList.generateHolder() method, except that generateHolder()
produces a byte-code representation of how to produce the row, and
buildRowTemplate() produces a Java data structure holding the same
Factored out shared logic from generateHolder() and buildRowTemplate()
Use RCL.buildRowTemplate() instead of RCL.generateHolder() when
creating constructor arguments for a sub-class of ScanResultSet.
Changed signatures to allow passing array index into GPS.savedObjects
instead of generated method as scan parameter.
Create the candidate row using the passed-in ExecRowBuilder, and also
use the ExecRowBuilder to reset the candidate row.
Changed signature of constructor to index into GPS.savedObjects
instead of generated method. Use the ExecRowBuilder to reset the
More signature changes to allow passing the GPS.savedObjects index
instead of the generated method.
Bulk insert creates a BulkTableScanResultSet at run-time and needs a
way to pass a row template to the scan. Previously, it did this by
wrapping a row instance in a class that implemented the
GeneratedMethod interface, although it didn't actually represent a
generated method. Now, since BulkTableScanResultSet expects an index
into GPS.savedObjects, we instead save an ExecRowBuilder instance when
compiling the bulk insert, and let InsertResultSet pass the array
index to getBulkTableScanResultSet().
InsertNode also needed a fix in requestBulkInsert(). It does some bind
logic in the optimize phase (legitimately, because of
forgets to update the bulkInsert field which is usually set during
bind. We now set bulkInsert to true also when this method is called,
so that we can use the field in the code generation phase.
Since InsertResultSet now gets its row template added to the plan at
compile-time, remove the logic to add it to and get it from the
constant action. This logic was also present for update and delete,
although it was only used in bulk insert. Remove for update and delete