578
576
select_lex->master_unit() == &session->lex->unit)) // upper level SELECT
580
578
zero_result_cause= "no matching row in const table";
579
goto setup_subq_exit;
584
581
if (!(session->options & OPTION_BIG_SELECTS) &&
585
582
best_read > (double) session->variables.max_join_size &&
5385
5391
join->unit->select_limit_cnt= 1; // Only send first row
5388
Field **first_field=entry->field+entry->getShare()->fields - field_count;
5394
Field **first_field=entry->getFields() + entry->getShare()->sizeFields() - field_count;
5389
5395
offset= (field_count ?
5390
entry->field[entry->getShare()->fields - field_count]->
5391
offset(entry->record[0]) : 0);
5392
reclength= entry->getShare()->reclength-offset;
5396
entry->getField(entry->getShare()->sizeFields() - field_count)->offset(entry->record[0]) : 0);
5397
reclength= entry->getShare()->getRecordLength() - offset;
5394
5399
entry->free_io_cache(); // Safety
5395
5400
entry->cursor->info(HA_STATUS_VARIABLE);
5396
5401
if (entry->getShare()->db_type() == heap_engine ||
5397
5402
(!entry->getShare()->blob_fields &&
5398
5403
((ALIGN_SIZE(reclength) + HASH_OVERHEAD) * entry->cursor->stats.records <
5399
session->variables.sortbuff_size)))
5404
session->variables.sortbuff_size)))
5400
5406
error= remove_dup_with_hash_index(join->session, entry,
5401
field_count, first_field,
5407
field_count, first_field,
5404
error= remove_dup_with_compare(join->session, entry, first_field, offset,
5412
error= remove_dup_with_compare(join->session, entry, first_field, offset, having);
5407
5415
free_blobs(first_field);
5507
5516
table->reginfo.join_tab=s;
5508
5517
table->reginfo.not_exists_optimize=0;
5509
5518
memset(table->const_key_parts, 0,
5510
sizeof(key_part_map)*table->getShare()->keys);
5519
sizeof(key_part_map)*table->getShare()->sizeKeys());
5511
5520
all_table_map|= table->map;
5513
5522
s->info=0; // For describe
6046
6055
for (uint32_t i=0 ; i < join_tab->ref.key_parts ; i++)
6048
Field *field=table->field[table->key_info[join_tab->ref.key].key_part[i].
6057
Field *field=table->getField(table->key_info[join_tab->ref.key].key_part[i].fieldnr - 1);
6050
6058
Item *value=join_tab->ref.items[i];
6051
6059
cond->add(new Item_func_equal(new Item_field(field), value));