Make NibbleIterator check for options before using them.

This commit is contained in:
Daniel Nichter
2012-03-22 11:28:58 -06:00
parent 138e980b7e
commit 20d2aa7a08

View File

@@ -66,10 +66,14 @@ sub new {
# and if table can be nibbled in one chunk. # and if table can be nibbled in one chunk.
my $nibble_params = can_nibble(%args); my $nibble_params = can_nibble(%args);
my $where = $o->get('where'); my $where = $o->has('where') ? $o->get('where') : '';
my $tbl_struct = $tbl->{tbl_struct}; my $tbl_struct = $tbl->{tbl_struct};
my $ignore_col = $o->get('ignore-columns') || {}; my $ignore_col = $o->has('ignore-columns')
my $all_cols = $o->get('columns') || $tbl_struct->{cols}; ? ($o->get('ignore-columns') || {})
: {};
my $all_cols = $o->has('columns')
? ($o->get('columns') || $tbl_struct->{cols})
: $tbl_struct->{cols};
my @cols = grep { !$ignore_col->{$_} } @$all_cols; my @cols = grep { !$ignore_col->{$_} } @$all_cols;
my $self; my $self;
if ( $nibble_params->{one_nibble} ) { if ( $nibble_params->{one_nibble} ) {
@@ -416,7 +420,7 @@ sub can_nibble {
my ($row_est, $mysql_index) = get_row_estimate( my ($row_est, $mysql_index) = get_row_estimate(
Cxn => $cxn, Cxn => $cxn,
tbl => $tbl, tbl => $tbl,
where => $o->get('where'), where => $o->has('where') ? $o->get('where') : '',
); );
# Can all those rows be nibbled in one chunk? If one_nibble is defined, # Can all those rows be nibbled in one chunk? If one_nibble is defined,