Skip to content
Permalink
Browse files
Add direct aggregates
Spider patches 026 (MDEV-7723), 031 (MDEV-7727) and 058 (MDEV-12532)

This allows the storage engine to internally compute sum and count
operations.

- Enhance sum items to be able to store the sum value directly.
- return_record_by_parent() is enabled in spider as
  HANDLER_HAS_DIRECT_AGGREGATE is defined
- Added spd_environ.h to spider. This is loaded first to ensure that all
  MariaDB specific defines that are used by include files are properly
  defined.
- This code is tested by the existing spider tests direct_aggregate.test
  and direct_aggregate_part.test and also partition.test
  • Loading branch information
montywi committed Dec 3, 2017
1 parent 6f5a7e9 commit da26d16
Show file tree
Hide file tree
Showing 28 changed files with 379 additions and 96 deletions.
@@ -513,6 +513,9 @@ COUNT(*)
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c)
400
SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SUM(c+0.0)
400.0
ALTER TABLE t1 DROP INDEX b;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
COUNT(*)
@@ -445,6 +445,7 @@ INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
(1,19,1);
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SELECT SUM(c+0.0) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
ALTER TABLE t1 DROP INDEX b;
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
@@ -4212,7 +4212,6 @@ int ha_partition::write_row(uchar * buf)
sql_mode_t saved_sql_mode= thd->variables.sql_mode;
bool saved_auto_inc_field_not_null= table->auto_increment_field_not_null;
DBUG_ENTER("ha_partition::write_row");
DBUG_ASSERT(buf == m_rec0);

/*
If we have an auto_increment column and we are writing a changed row
@@ -3499,7 +3499,7 @@ class handler :public Sql_alloc
return 0;
}
virtual void set_part_info(partition_info *part_info) {return;}
virtual void return_record_by_parent() {return;}
virtual void return_record_by_parent() { return; }

virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;

@@ -5848,6 +5848,7 @@ class Item_cache: public Item_basic_constant,
}

virtual void store(Item *item);
virtual Item *get_item() { return example; }
virtual bool cache_value()= 0;
bool basic_const_item() const
{ return MY_TEST(example && example->basic_const_item()); }

0 comments on commit da26d16

Please sign in to comment.