@Override
protected Table<Integer, Comparable, Object> createTable( TupleEntryIterator entryIterator, boolean useOrdinal )
{
Table<Integer, Comparable, Object> table = createNullableTable();
JavaTypeFactory typeFactory = new FieldTypeFactory();
int row = 0;
while( entryIterator.hasNext() )
{
TupleEntry entry = entryIterator.next();
for( Comparable field : entry.getFields() )
{
// we must coerce into the actual sql type returned by the result-set
Object value = entry.getObject( field );
int columnPos = entry.getFields().getPos( field );
Type type = entry.getFields().getType( columnPos );
if( type instanceof BasicSqlType )
{
value = ( (CoercibleType) type ).coerce( value, typeFactory.getJavaClass( ( (BasicSqlType) type ) ) );
// for date-time types, the canonical type (int or long) -- chosen for
// efficient internal processing -- is not what is returned to the
// end-user from JDBC (java.sql.Date etc.)
switch( ( (BasicSqlType) type ).getSqlTypeName() )