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

Method test_dml_end_time

tests/query_test/test_observability.py:1015–1048  ·  view source on GitHub ↗

Same as the above test but verifies the end time of DML is set only after the work in catalogd is done.

(self, unique_database)

Source from the content-addressed store, hash-verified

1013 assert end_time is not None
1014
1015 def test_dml_end_time(self, unique_database):
1016 """Same as the above test but verifies the end time of DML is set only after the work
1017 in catalogd is done."""
1018 stmt = "create table %s.alltypestiny like functional.alltypestiny" % unique_database
1019 self.execute_query(stmt)
1020 # Warm up the table
1021 self.execute_query("describe %s.alltypestiny" % unique_database)
1022 stmt = "insert overwrite %s.alltypestiny partition(year, month)" \
1023 " select * from functional.alltypestiny" % unique_database
1024 # Use debug_action to inject a delay in catalogd. The INSERT usually finishes in
1025 # 300ms without the delay.
1026 delay_s = 5
1027 self.hs2_client.set_configuration_option(
1028 "debug_action", "catalogd_insert_finish_delay:SLEEP@%d" % (delay_s * 1000))
1029 start_ts = time()
1030 handle = self.hs2_client.execute_async(stmt)
1031 self.hs2_client.clear_configuration()
1032 end_time_str = ""
1033 duration_str = ""
1034 while len(end_time_str) == 0:
1035 sleep(1)
1036 tree = self.hs2_client.get_runtime_profile(handle, TRuntimeProfileFormat.THRIFT)
1037 end_time_str = tree.nodes[1].info_strings["End Time"]
1038 duration_str = tree.nodes[1].info_strings["Duration"]
1039 # End time should not show up earlier than the delay.
1040 if time() - start_ts < delay_s:
1041 assert len(end_time_str) == 0, "End time show up too early: {end_str}. " \
1042 "{delay_s} second delay expected since " \
1043 "{start_str} ({start_ts:.6f})".format(
1044 end_str=end_time_str, delay_s=delay_s, start_ts=start_ts,
1045 start_str=datetime.utcfromtimestamp(start_ts).strftime('%Y-%m-%d %H:%M:%S.%f'))
1046 self.hs2_client.close_query(handle)
1047 duration_us = get_duration_us_from_str(duration_str)
1048 assert duration_us > delay_s * 1000000
1049
1050 def test_query_profile_contains_number_of_fragment_instance(self):
1051 """Test that the expected section for number of fragment instance in

Callers

nothing calls this directly

Calls 9

get_duration_us_from_strFunction · 0.90
timeFunction · 0.85
execute_queryMethod · 0.45
execute_asyncMethod · 0.45
clear_configurationMethod · 0.45
get_runtime_profileMethod · 0.45
formatMethod · 0.45
close_queryMethod · 0.45

Tested by

no test coverage detected