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

Class QueryReport

tests/stress/query_runner.py:390–461  ·  view source on GitHub ↗

Holds information about a single query run.

Source from the content-addressed store, hash-verified

388
389
390class QueryReport(object):
391 """Holds information about a single query run."""
392
393 def __init__(self, query):
394 self.query = query
395
396 self.result_hash = None
397 self.runtime_secs = None
398 self.mem_was_spilled = False
399 # not_enough_memory includes conditions like "Memory limit exceeded", admission
400 # control rejecting because not enough memory, etc.
401 self.not_enough_memory = False
402 # ac_rejected is true if the query was rejected by admission control.
403 # It is mutually exclusive with not_enough_memory - if the query is rejected by
404 # admission control because the memory limit is too low, it is counted as
405 # not_enough_memory.
406 # TODO: reconsider whether they should be mutually exclusive
407 self.ac_rejected = False
408 self.ac_timedout = False
409 self.other_error = None
410 self.timed_out = False
411 self.was_cancelled = False
412 self.profile = None
413 self.query_id = None
414
415 def __str__(self):
416 return dedent("""
417 <QueryReport
418 result_hash: %(result_hash)s
419 runtime_secs: %(runtime_secs)s
420 mem_was_spilled: %(mem_was_spilled)s
421 not_enough_memory: %(not_enough_memory)s
422 ac_rejected: %(ac_rejected)s
423 ac_timedout: %(ac_timedout)s
424 other_error: %(other_error)s
425 timed_out: %(timed_out)s
426 was_cancelled: %(was_cancelled)s
427 query_id: %(query_id)s
428 >
429 """.strip() % self.__dict__)
430
431 def has_query_error(self):
432 """Return true if any kind of error status was returned from the query (i.e.
433 the query didn&#x27;t run to completion, time out or get cancelled)."""
434 return (self.not_enough_memory or self.ac_rejected or self.ac_timedout
435 or self.other_error)
436
437 def write_query_profile(self, directory, prefix=None):
438 """
439 Write out the query profile bound to this object to a given directory.
440
441 The file name is generated and will contain the query ID. Use the optional prefix
442 parameter to set a prefix on the filename.
443
444 Example return:
445 tpcds_300_decimal_parquet_q21_00000001_a38c8331_profile.txt
446
447 Parameters:

Callers 1

run_queryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected