1 #include <gtest/gtest.h>
3 #include "hash-store.h"
4 #include "standard-hash-table.h"
5 #include "tuple-types.h"
11 using namespace impala;
22 template <
int buffer_size>
25 ProbeTuple*
tuples = GenTuples(num_probe_tuples, max_id);
26 HashStore<buffer_size> hs;
29 hs.Aggregate(tuples, num_probe_tuples);
31 SanityCheck<buffer_size>(hs, num_probe_tuples, max_id, num_tables);
38 template <
int buffer_size>
40 uint64_t num_probe_tuples,
int max_id,
int num_tables) {
41 ASSERT_EQ(num_probe_tuples, hs.TupleCount());
44 ASSERT_EQ(num_tables, hs.TableCount())
45 <<
"You do not have the number of tables that you hoped.\n"
46 <<
"This could mean that there weren't enough probe tuples to fill the keyspace, "
47 <<
"skewed hashing lead a hash table that we expected not to overflow to overflow, "
48 <<
"or a genuine bug.";
50 if (buffer_size > 0) {
57 template <
int buffer_size>
66 delta =
static_cast<int64_t
>(time) - static_cast<int64_t>(prev);
68 LOG(ERROR) << build_tuples <<
"\t"
77 template <
int buffer_size>
78 inline static void Test() {
82 LOG(ERROR) <<
"#BuildTuples\tTime\tdTime";
84 for (
int num_tables = 1; num_tables <= 1<<16; num_tables *= 2) {
92 int build_tuples = (StandardHashTable::NODES * num_tables / 10) * 8;
93 prev = NextTestCase<buffer_size>(build_tuples, prev, num_tables);
100 int main(
int argc,
char** argv) {
101 google::InitGoogleLogging(argv[0]);
102 ::testing::InitGoogleTest(&argc, argv);
105 return RUN_ALL_TESTS();
111 GrowingTest::Test< (1 << 13) + 3 * 64 >();
uint64_t ElapsedTime() const
Returns time in cpu ticks.
static void SanityCheck(const HashStore< buffer_size > &hs, uint64_t num_probe_tuples, int max_id, int num_tables)
ProbeTuple tuples[BUFFER_TUPLES]
static std::string Print(bool value, TUnit::type ignored, bool verbose=false)
static uint64_t NextTestCase(int build_tuples, uint64_t prev, int num_tables)
static const uint64_t NUM_PROBE_TUPLES
uint64_t Test(T *ht, const ProbeTuple *input, uint64_t num_tuples)
int main(int argc, char **argv)
static void Init()
Initialize CpuInfo.
static uint64_t AggregateTest(uint64_t num_probe_tuples, int max_id, int num_tables)