1515
1616import io .trino .tempto .assertions .QueryAssert ;
1717import io .trino .tempto .query .QueryResult ;
18+ import io .trino .testng .services .Flaky ;
1819import io .trino .tests .product .hive .util .TemporaryHiveTable ;
1920import org .testng .annotations .DataProvider ;
2021import org .testng .annotations .Test ;
3435import static io .trino .tests .product .hive .TestHiveTransactionalTable .TEST_TIMEOUT ;
3536import static io .trino .tests .product .hive .TestHiveTransactionalTable .tableName ;
3637import static io .trino .tests .product .hive .TestHiveTransactionalTable .verifySelectForTrinoAndHive ;
38+ import static io .trino .tests .product .utils .HadoopTestUtils .RETRYABLE_FAILURES_ISSUES ;
39+ import static io .trino .tests .product .utils .HadoopTestUtils .RETRYABLE_FAILURES_MATCH ;
3740import static io .trino .tests .product .utils .QueryExecutors .onHive ;
3841import static io .trino .tests .product .utils .QueryExecutors .onTrino ;
3942import static java .lang .String .format ;
@@ -44,6 +47,7 @@ public class TestHiveMerge
4447 extends HiveProductTest
4548{
4649 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
50+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
4751 public void testMergeSimpleSelect ()
4852 {
4953 withTemporaryTable ("merge_simple_select_target" , false , NONE , targetTable -> {
@@ -69,6 +73,7 @@ public void testMergeSimpleSelect()
6973 }
7074
7175 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
76+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
7277 public void testMergeSimpleSelectPartitioned ()
7378 {
7479 withTemporaryTable ("merge_simple_select_partitioned_target" , true , NONE , targetTable -> {
@@ -94,6 +99,7 @@ public void testMergeSimpleSelectPartitioned()
9499 }
95100
96101 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = TEST_TIMEOUT , dataProvider = "partitionedAndBucketedProvider" )
102+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
97103 public void testMergeUpdateWithVariousLayouts (boolean partitioned , String bucketing )
98104 {
99105 BucketingType bucketingType = bucketing .isEmpty () ? NONE : BUCKETED_V2 ;
@@ -131,6 +137,7 @@ public void testMergeUpdateWithVariousLayouts(boolean partitioned, String bucket
131137 }
132138
133139 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = TEST_TIMEOUT )
140+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
134141 public void testMergeUnBucketedUnPartitionedFailure ()
135142 {
136143 withTemporaryTable ("merge_with_various_formats_failure" , false , NONE , targetTable -> {
@@ -168,6 +175,7 @@ public Object[][] partitionedAndBucketedProvider()
168175 }
169176
170177 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
178+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
171179 public void testMergeMultipleOperationsUnbucketedUnpartitioned ()
172180 {
173181 withTemporaryTable ("merge_multiple" , false , NONE , targetTable -> {
@@ -177,6 +185,7 @@ public void testMergeMultipleOperationsUnbucketedUnpartitioned()
177185 }
178186
179187 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
188+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
180189 public void testMergeMultipleOperationsUnbucketedPartitioned ()
181190 {
182191 withTemporaryTable ("merge_multiple" , true , NONE , targetTable -> {
@@ -186,6 +195,7 @@ public void testMergeMultipleOperationsUnbucketedPartitioned()
186195 }
187196
188197 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
198+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
189199 public void testMergeMultipleOperationsBucketedUnpartitioned ()
190200 {
191201 withTemporaryTable ("merge_multiple" , false , BUCKETED_V2 , targetTable -> {
@@ -261,6 +271,7 @@ private List<QueryAssert.Row> getRowsFromQueryResult(QueryResult result)
261271 }
262272
263273 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
274+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
264275 public void testMergeSimpleQuery ()
265276 {
266277 withTemporaryTable ("merge_simple_query_target" , false , NONE , targetTable -> {
@@ -281,6 +292,7 @@ public void testMergeSimpleQuery()
281292 }
282293
283294 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
295+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
284296 public void testMergeAllInserts ()
285297 {
286298 withTemporaryTable ("merge_all_inserts" , false , NONE , targetTable -> {
@@ -299,6 +311,7 @@ public void testMergeAllInserts()
299311 }
300312
301313 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
314+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
302315 public void testMergeSimpleQueryPartitioned ()
303316 {
304317 withTemporaryTable ("merge_simple_query_partitioned_target" , true , NONE , targetTable -> {
@@ -320,6 +333,7 @@ public void testMergeSimpleQueryPartitioned()
320333 }
321334
322335 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
336+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
323337 public void testMergeAllColumnsUpdated ()
324338 {
325339 withTemporaryTable ("merge_all_columns_updated_target" , false , NONE , targetTable -> {
@@ -341,6 +355,7 @@ public void testMergeAllColumnsUpdated()
341355 }
342356
343357 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
358+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
344359 public void testMergeAllMatchesDeleted ()
345360 {
346361 withTemporaryTable ("merge_all_matches_deleted_target" , false , NONE , targetTable -> {
@@ -362,6 +377,7 @@ public void testMergeAllMatchesDeleted()
362377 }
363378
364379 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 , dataProvider = "partitionedBucketedFailure" )
380+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
365381 public void testMergeMultipleRowsMatchFails (String createTableSql )
366382 {
367383 withTemporaryTable ("merge_all_matches_deleted_target" , true , NONE , targetTable -> {
@@ -398,6 +414,7 @@ public Object[][] partitionedBucketedFailure()
398414 }
399415
400416 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
417+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
401418 public void testMergeFailingPartitioning ()
402419 {
403420 String testDescription = "failing_merge" ;
@@ -424,6 +441,7 @@ public void testMergeFailingPartitioning()
424441 }
425442
426443 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
444+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
427445 public void testMergeFailureWithDifferentPartitioning ()
428446 {
429447 testMergeWithDifferentPartitioningInternal (
@@ -433,6 +451,7 @@ public void testMergeFailureWithDifferentPartitioning()
433451 }
434452
435453 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 , dataProvider = "targetAndSourceWithDifferentPartitioning" )
454+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
436455 public void testMergeWithDifferentPartitioning (String testDescription , String createTargetTableSql , String createSourceTableSql )
437456 {
438457 testMergeWithDifferentPartitioningInternal (testDescription , createTargetTableSql , createSourceTableSql );
@@ -500,6 +519,7 @@ public Object[][] targetAndSourceWithDifferentPartitioning()
500519 }
501520
502521 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
522+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
503523 public void testMergeQueryWithStrangeCapitalization ()
504524 {
505525 withTemporaryTable ("test_without_aliases_target" , false , NONE , targetTable -> {
@@ -519,6 +539,7 @@ public void testMergeQueryWithStrangeCapitalization()
519539 }
520540
521541 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
542+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
522543 public void testMergeWithoutTablesAliases ()
523544 {
524545 withTemporaryTable ("test_without_aliases_target" , false , NONE , targetTable -> {
@@ -543,6 +564,7 @@ public void testMergeWithoutTablesAliases()
543564 }
544565
545566 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
567+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
546568 public void testMergeWithUnpredictablePredicates ()
547569 {
548570 withTemporaryTable ("test_without_aliases_target" , false , NONE , targetTable -> {
@@ -584,6 +606,7 @@ public void testMergeWithUnpredictablePredicates()
584606 }
585607
586608 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
609+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
587610 public void testMergeWithSimplifiedUnpredictablePredicates ()
588611 {
589612 withTemporaryTable ("test_without_aliases_target" , false , NONE , targetTable -> {
@@ -609,6 +632,7 @@ public void testMergeWithSimplifiedUnpredictablePredicates()
609632 }
610633
611634 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
635+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
612636 public void testMergeCasts ()
613637 {
614638 withTemporaryTable ("merge_cast_target" , false , NONE , targetTable -> {
@@ -631,6 +655,7 @@ public void testMergeCasts()
631655 }
632656
633657 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
658+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
634659 public void testMergeSubqueries ()
635660 {
636661 withTemporaryTable ("merge_nation_target" , false , NONE , targetTable -> {
@@ -656,6 +681,7 @@ public void testMergeSubqueries()
656681 }
657682
658683 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = 60 * 60 * 1000 )
684+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
659685 public void testMergeOriginalFilesTarget ()
660686 {
661687 withTemporaryTable ("region" , false , NONE , targetTable -> {
@@ -678,6 +704,7 @@ public void testMergeOriginalFilesTarget()
678704 }
679705
680706 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = TEST_TIMEOUT )
707+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
681708 public void testMergeOverManySplits ()
682709 {
683710 withTemporaryTable ("delete_select" , false , NONE , targetTable -> {
@@ -696,6 +723,7 @@ public void testMergeOverManySplits()
696723 }
697724
698725 @ Test (groups = {HIVE_TRANSACTIONAL , PROFILE_SPECIFIC_TESTS }, timeOut = TEST_TIMEOUT )
726+ @ Flaky (issue = RETRYABLE_FAILURES_ISSUES , match = RETRYABLE_FAILURES_MATCH )
699727 public void testMergeFalseJoinCondition ()
700728 {
701729 withTemporaryTable ("join_false" , false , NONE , targetTable -> {
0 commit comments