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

Method test_large_sql

tests/shell/test_shell_commandline.py:1153–1188  ·  view source on GitHub ↗
(self, vector, unique_database)

Source from the content-addressed store, hash-verified

1151 assert "Encountered: Unexpected character" in result.stderr
1152
1153 def test_large_sql(self, vector, unique_database):
1154 if vector.get_value('strict_hs2_protocol'):
1155 pytest.skip("IMPALA-10827: Test did not pass for strict hs2 mode.")
1156 # In this test, we are only interested in the performance of Impala shell and not
1157 # the performance of Impala in general. So, this test will execute a large query
1158 # from a non-existent table since this will make the query execution time negligible.
1159 sql_file, sql_path = tempfile.mkstemp()
1160 # This generates a sql file size of ~50K.
1161 num_cols = 1000
1162 with open(sql_path, 'w') as f:
1163 f.write("select \n")
1164 for i in range(num_cols):
1165 if i < num_cols:
1166 f.write("col_{0} as a{1},\n".format(i, i))
1167 f.write("col_{0} as b{1},\n".format(i, i))
1168 f.write("col_{0} as c{1}{2}\n".format(
1169 i, i, "," if i < num_cols - 1 else ""))
1170 f.write("from non_existence_large_table;")
1171 f.close()
1172
1173 try:
1174 args = ['-f', sql_path, '-d', unique_database]
1175 start_time = time()
1176 result = run_impala_shell_cmd(vector, args, expect_success=False)
1177 assert "Could not resolve table reference: 'non_existence_large_table'" \
1178 in result.stderr
1179 end_time = time()
1180 # Use higher timeout in ASAN/UBSAN to avoid flakiness (IMPALA-11921).
1181 build_runs_slowly = ImpalaTestClusterProperties.get_instance().runs_slowly()
1182 time_limit_s = 60 if build_runs_slowly else 20
1183 actual_time_s = end_time - start_time
1184 assert actual_time_s <= time_limit_s, (
1185 "It took {0} seconds to execute the query. Time limit is {1} seconds.".format(
1186 actual_time_s, time_limit_s))
1187 finally:
1188 os.remove(sql_path)
1189
1190 @pytest.mark.skipif(ImpalaTestClusterProperties.get_instance().is_remote_cluster(),
1191 reason='Test assumes a minicluster.')

Callers

nothing calls this directly

Calls 11

run_impala_shell_cmdFunction · 0.90
rangeFunction · 0.85
timeFunction · 0.85
skipMethod · 0.80
runs_slowlyMethod · 0.80
get_instanceMethod · 0.80
closeMethod · 0.65
get_valueMethod · 0.45
writeMethod · 0.45
formatMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected