aokolnychyi commented on code in PR #55623:
URL: https://github.com/apache/spark/pull/55623#discussion_r3190468313
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalyzerExtensionPropagationSuite.scala:
##########
@@ -54,6 +54,22 @@ class AnalyzerExtensionPropagationSuite extends
SparkFunSuite {
new SessionCatalog(new InMemoryCatalog, EmptyFunctionRegistry))
test("withCatalogManager propagates all extension points") {
+ // Counts every declared field on Analyzer (backing fields for vals,
+ // constructor params, and fields inherited from mixed-in traits). When
this assertion fails,
+ // a field was added to or removed from Analyzer. If the change is a new
extension point,
+ // add it to Analyzer.withCatalogManager, add an assertion in the clone
checks below,
+ // and update EXPECTED_FIELD_COUNT.
+ val EXPECTED_FIELD_COUNT = 12
Review Comment:
This seems more reliable. Thanks!
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/AnalyzerExtensionPropagationSuite.scala:
##########
@@ -54,6 +54,22 @@ class AnalyzerExtensionPropagationSuite extends
SparkFunSuite {
new SessionCatalog(new InMemoryCatalog, EmptyFunctionRegistry))
test("withCatalogManager propagates all extension points") {
+ // Counts every declared field on Analyzer (backing fields for vals,
+ // constructor params, and fields inherited from mixed-in traits). When
this assertion fails,
+ // a field was added to or removed from Analyzer. If the change is a new
extension point,
+ // add it to Analyzer.withCatalogManager, add an assertion in the clone
checks below,
+ // and update EXPECTED_FIELD_COUNT.
+ val EXPECTED_FIELD_COUNT = 12
+ val analyzerFields = classOf[Analyzer].getDeclaredFields
+ .filterNot(f => f.isSynthetic || f.getName.contains("$"))
+ assert(analyzerFields.length == EXPECTED_FIELD_COUNT,
+ s"Analyzer has ${analyzerFields.length} declared fields " +
+ s"(${analyzerFields.map(_.getName).sorted.mkString(", ")}), " +
+ s"but expected $EXPECTED_FIELD_COUNT. " +
+ s"If a new extension point was added, register it in
Analyzer.withCatalogManager, " +
+ s"add an assertion in this test, and update EXPECTED_FIELD_COUNT.")
+
+
Review Comment:
Minor: extra empty line?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]