my @idcol_args = $no_rowid_container ? ('', '') : (
', %cur_row_ids', # only declare the variable if we'll use it
join ("\n", map {
- qq(\$cur_row_ids{$_} = defined(\$cur_row_data->[$_]) ? \$cur_row_data->[$_] : "\0NULL\xFF\$rows_pos\xFF$_\0";)
- } sort { $a <=> $b } keys %{ $stats->{idcols_seen} } )
+ # in case we prune - we will never hit these undefs
+ $args->{prune_null_branches}
+ ? qq(\$cur_row_ids{$_} = \$cur_row_data->[$_];)
+ : qq(\$cur_row_ids{$_} = defined(\$cur_row_data->[$_]) ? \$cur_row_data->[$_] : "\0NULL\xFF\$rows_pos\xFF$_\0";)
+ } sort { $a <=> $b } keys %{ $stats->{idcols_seen} } ),
);
my $parser_src = sprintf (<<'EOS', @idcol_args, $top_node_key_assembler||'', $top_node_key, join( "\n", @{$data_assemblers||[]} ) );
( $_[1] and $rows_pos = -1 and $_[1]->() )
) ) {
- # this code exists only when we are *not* assembling direct to HRI
+ # this code exists only when we are using a cur_row_ids
+ # furthermore the undef checks may or may not be there
+ # depending on whether we prune or not
#
# due to left joins some of the ids may be NULL/undef, and
# won't play well when used as hash lookups
( $_[1] and $rows_pos = -1 and $_[1]->() )
) ) {
- $cur_row_ids{0} = defined $cur_row_data->[0] ? $cur_row_data->[0] : "\0NULL\xFF$rows_pos\xFF0\0";
- $cur_row_ids{2} = defined $cur_row_data->[2] ? $cur_row_data->[2] : "\0NULL\xFF$rows_pos\xFF2\0";
- $cur_row_ids{3} = defined $cur_row_data->[3] ? $cur_row_data->[3] : "\0NULL\xFF$rows_pos\xFF3\0";
- $cur_row_ids{4} = defined $cur_row_data->[4] ? $cur_row_data->[4] : "\0NULL\xFF$rows_pos\xFF4\0";
- $cur_row_ids{8} = defined $cur_row_data->[8] ? $cur_row_data->[8] : "\0NULL\xFF$rows_pos\xFF8\0";
+ # do not care about nullability here
+ $cur_row_ids{0} = $cur_row_data->[0];
+ $cur_row_ids{2} = $cur_row_data->[2];
+ $cur_row_ids{3} = $cur_row_data->[3];
+ $cur_row_ids{4} = $cur_row_data->[4];
+ $cur_row_ids{8} = $cur_row_data->[8];
# cache expensive set of ops in a non-existent rowid slot
$cur_row_ids{10} = (