diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
index 019d752a13dd05fa4d711834843c5e64eb0f36fb..cfca93bbf0659ef07ae572f1a8d735a0d4834c7e 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
@@ -409,7 +409,10 @@ abstract class HiveComparisonTest
                 }
 
                 try {
-                  new TestHive.QueryExecution(convertedSQL)
+                  val queryExecution = new TestHive.QueryExecution(convertedSQL)
+                  // Trigger the analysis of this converted SQL query.
+                  queryExecution.analyzed
+                  queryExecution
                 } catch {
                   case NonFatal(e) => fail(
                     s"""Failed to analyze the converted SQL string: