MCPcopy Create free account
hub / github.com/apache/impala / test_aggregate

Method test_aggregate

tests/custom_cluster/test_tuple_cache.py:361–384  ·  view source on GitHub ↗

Simple aggregation can be cached

(self, vector, unique_database)

Source from the content-addressed store, hash-verified

359 assertCounters(exempt3.runtime_profile, num_hits=1, num_halted=0, num_skipped=0)
360
361 def test_aggregate(self, vector, unique_database):
362 """Simple aggregation can be cached"""
363 self.client.set_configuration(vector.get_value('exec_option'))
364 fq_table = "{0}.agg".format(unique_database)
365 self.create_table(fq_table)
366
367 result1 = self.execute_query("SELECT sum(age) FROM {0}".format(fq_table))
368 result2 = self.execute_query("SELECT sum(age) FROM {0}".format(fq_table))
369
370 assert result1.success
371 assert result2.success
372 assert result1.data == result2.data
373 assertCounters(result1.runtime_profile, 0, 0, 0, num_matches=2)
374 # Aggregate should hit, and scan node below it will miss.
375 assertCounterOrder(result2.runtime_profile, NUM_HITS, [1, 0])
376 assertCounter(result2.runtime_profile, NUM_HALTED, 0, num_matches=2)
377 assertCounter(result2.runtime_profile, NUM_SKIPPED, 0, num_matches=2)
378 # Verify that the bytes written by the first profile are the same as the bytes
379 # read by the second profile.
380 bytes_written = getCounterValues(result1.runtime_profile, "TupleCacheBytesWritten")
381 bytes_read = getCounterValues(result2.runtime_profile, "TupleCacheBytesRead")
382 assert len(bytes_written) == 2
383 assert len(bytes_read) == 1
384 assert bytes_written[0] == bytes_read[0]
385
386 def test_aggregate_reuse(self, vector):
387 """Cached aggregation can be re-used"""

Callers

nothing calls this directly

Calls 9

assertCountersFunction · 0.85
assertCounterOrderFunction · 0.85
assertCounterFunction · 0.85
getCounterValuesFunction · 0.85
set_configurationMethod · 0.80
get_valueMethod · 0.45
formatMethod · 0.45
create_tableMethod · 0.45
execute_queryMethod · 0.45

Tested by

no test coverage detected