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

Method test_insert_overwrite

tests/query_test/test_iceberg.py:204–243  ·  view source on GitHub ↗

Run iceberg-overwrite tests, then test that INSERT INTO/OVERWRITE queries running concurrently with a long running INSERT OVERWRITE are handled gracefully. query_a is started before query_b/query_c, but query_b/query_c are supposed to finish before query_a. query_a should fail because th

(self, vector, unique_database)

Source from the content-addressed store, hash-verified

202 use_db=unique_database)
203
204 def test_insert_overwrite(self, vector, unique_database):
205 """Run iceberg-overwrite tests, then test that INSERT INTO/OVERWRITE queries running
206 concurrently with a long running INSERT OVERWRITE are handled gracefully. query_a is
207 started before query_b/query_c, but query_b/query_c are supposed to finish before
208 query_a. query_a should fail because the overwrite should not erase query_b/query_c's
209 result."""
210 # Run iceberg-overwrite.test
211 self.run_test_case('QueryTest/iceberg-overwrite', vector, use_db=unique_database)
212
213 # Create test dataset for concurrency tests and warm-up the test table
214 tbl_name = unique_database + ".overwrite_tbl"
215 self.client.execute("""create table {0} (i int)
216 partitioned by spec (truncate(3, i))
217 stored as iceberg""".format(tbl_name))
218 self.client.execute("insert into {0} values (1), (2), (3);".format(tbl_name))
219
220 # Test queries: 'a' is the long running query while 'b' and 'c' are the short ones
221 query_a = """insert overwrite {0} select sleep(5000);""".format(tbl_name)
222 query_b = """insert overwrite {0} select * from {0};""".format(tbl_name)
223 query_c = """insert into {0} select * from {0};""".format(tbl_name)
224
225 # Test concurrent INSERT OVERWRITEs, the exception closes the query handle.
226 handle = self.client.execute_async(query_a)
227 time.sleep(1)
228 self.client.execute(query_b)
229 try:
230 self.client.wait_for_finished_timeout(handle, 30)
231 assert False
232 except IMPALA_CONNECTION_EXCEPTION as e:
233 assert "Found conflicting files" in str(e)
234
235 # Test INSERT INTO during INSERT OVERWRITE, the exception closes the query handle.
236 handle = self.client.execute_async(query_a)
237 time.sleep(1)
238 self.client.execute(query_c)
239 try:
240 self.client.wait_for_finished_timeout(handle, 30)
241 assert False
242 except IMPALA_CONNECTION_EXCEPTION as e:
243 assert "Found conflicting files" in str(e)
244
245 def test_ctas(self, vector, unique_database):
246 self.run_test_case('QueryTest/iceberg-ctas', vector, use_db=unique_database)

Callers

nothing calls this directly

Calls 5

run_test_caseMethod · 0.80
executeMethod · 0.45
formatMethod · 0.45
execute_asyncMethod · 0.45

Tested by

no test coverage detected