Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] Fix flaky test in TPCHQuerySuite #5720

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
-- using default substitutions

select
100.00 * sum(case
round(100.00 * sum(case
when p_type like 'PROMO%'
then l_extendedprice * (1 - l_discount)
else 0
end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue
end) / sum(l_extendedprice * (1 - l_discount)), 2) as promo_revenue
Copy link
Contributor Author

@cxzl25 cxzl25 Nov 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GA

query q14 result: List([15.486545812284065])

Local Mac

query q14 result: List([15.486545812284069])

PR

query q14 result: List([15.49])

from
lineitem,
part
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ import org.apache.kyuubi.spark.connector.common.LocalSparkSession.withSparkSessi
/**
* To run this test suite:
* {{{
* KYUUBI_UPDATE=0 dev/gen/gen_tpcdh_queries.sh
* KYUUBI_UPDATE=0 dev/gen/gen_tpch_queries.sh
* }}}
*
* To re-generate golden files for this suite:
* {{{
* dev/gen/gen_tpcdh_queries.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

* dev/gen/gen_tpch_queries.sh
* }}}
*/
@Slow
Expand All @@ -59,20 +59,15 @@ class TPCHQuerySuite extends KyuubiFunSuite {
in.close()
queryName -> queryContent
}.foreach { case (name, sql) =>
try {
val result = spark.sql(sql).collect()
val schema = spark.sql(sql).schema
val schemaDDL = LICENSE_HEADER + schema.toDDL + "\n"
spark.createDataFrame(result.toList.asJava, schema).createTempView(s"$name$viewSuffix")
val sumHashResult = LICENSE_HEADER + spark.sql(
s"select sum(hash(*)) from $name$viewSuffix").collect().head.get(0) + "\n"
val tuple = generateGoldenFiles("kyuubi/tpch", name, schemaDDL, sumHashResult)
assert(schemaDDL == tuple._1)
assert(sumHashResult == tuple._2)
} catch {
case cause: Throwable =>
fail(name, cause)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot display the comparison results of assert

}
val result = spark.sql(sql).collect()
val schema = spark.sql(sql).schema
val schemaDDL = LICENSE_HEADER + schema.toDDL + "\n"
spark.createDataFrame(result.toList.asJava, schema).createTempView(s"$name$viewSuffix")
val sumHashResult = LICENSE_HEADER + spark.sql(
s"select sum(hash(*)) from $name$viewSuffix").collect().head.get(0) + "\n"
val tuple = generateGoldenFiles("kyuubi/tpch", name, schemaDDL, sumHashResult)
assert(schemaDDL == tuple._1, s"query $name schema not match")
assert(sumHashResult == tuple._2, s"query $name result not match")
}
}
}
Expand Down
Loading