-
Notifications
You must be signed in to change notification settings - Fork 28k
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
[SPARK-44039][CONNECT][TESTS] Improve for PlanGenerationTestSuite & ProtoToParsedPlanTestSuite #41572
Conversation
…rotoToParsedPlanTestSuite
@@ -103,6 +104,12 @@ class PlanGenerationTestSuite | |||
val client = SparkConnectClient(InProcessChannelBuilder.forName("/dev/null").build()) | |||
session = | |||
new SparkSession(client, cleaner = SparkSession.cleaner, planIdGenerator = new AtomicLong) | |||
if (regenerateGoldenFiles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple method is to delete all the corresponding directories when generating golden files. This way, in our logic, we won't accidentally submit redundant files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Thank you ! Personally, I feet delete all golden files and regenerate is OK.
@@ -103,6 +104,12 @@ class PlanGenerationTestSuite | |||
val client = SparkConnectClient(InProcessChannelBuilder.forName("/dev/null").build()) | |||
session = | |||
new SparkSession(client, cleaner = SparkSession.cleaner, planIdGenerator = new AtomicLong) | |||
if (regenerateGoldenFiles) { | |||
if (queryFilePath.toFile.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we can use Utils.deleteRecursively
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…rotoToParsedPlanTestSuite
cc @hvanhovell |
@@ -103,6 +105,12 @@ class PlanGenerationTestSuite | |||
val client = SparkConnectClient(InProcessChannelBuilder.forName("/dev/null").build()) | |||
session = | |||
new SparkSession(client, cleaner = SparkSession.cleaner, planIdGenerator = new AtomicLong) | |||
if (regenerateGoldenFiles) { | |||
if (queryFilePath.toFile.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extract queryFilePath.toFile
as a variable like val ...Path = queryFilePath.toFile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,
Meanwhile, let's verify #41579.
@@ -90,6 +92,13 @@ class ProtoToParsedPlanTestSuite | |||
" theid INTEGER, \"Dept\" INTEGER)") | |||
.executeUpdate() | |||
conn.commit() | |||
|
|||
if (regenerateGoldenFiles) { | |||
if (goldenFilePath.toFile.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
val queryFile = queryFilePath.toFile | ||
if (regenerateGoldenFiles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val queryFile = queryFilePath.toFile | |
if (regenerateGoldenFiles) { | |
if (regenerateGoldenFiles) { | |
val queryFile = queryFilePath.toFile |
val goldenFile = goldenFilePath.toFile | ||
if (regenerateGoldenFiles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val goldenFile = goldenFilePath.toFile | |
if (regenerateGoldenFiles) { | |
if (regenerateGoldenFiles) { | |
val goldenFile = goldenFilePath.toFile |
…rotoToParsedPlanTestSuite
LGTM. |
will re-generating golden files for single test or a group of tests still be supported after this PR? |
No longer supported, Let me improve it again. |
I have another concern, for testing backwards compatibility it might be useful to keep 'orphaned' protos around. This would effectively kill that. |
@zhengruifeng |
1.Very good reminder, but currently the orphan files deleted from the above, such as 2.At the same time, I have added additional explanatory notes in the code comments. 3.We should provide an automated function to find orphaned files, otherwise, finding files that can be deleted from over 600 files may be a bit difficult. As for whether to delete them, I think it needs to be weighed between the submitter and the code reviewer. Otherwise, many orphaned files are increasing, and many of them are only generated by submitting them incorrectly. For example, from the first submission of this PR to today, two orphan files have been generated: |
…rotoToParsedPlanTestSuite
Alright works for me. I guess orphaned protos will show up in the git diff now. I guess we can create a separate folder for the ones we want to keep. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM2
What changes were proposed in this pull request?
The pr aims to improve for PlanGenerationTestSuite & ProtoToParsedPlanTestSuite, include:
When generating
GOLDEN
files, we should first delete the corresponding directories and generate new ones to avoid submitting some redundant files during the review process. eg:When we write a test named
make_timestamp_ltz
for the overloaded method, and during the review process, the reviewer wishes to add more tests for the method. The name of this method has changed during the next submission process, such asmake_timestamp_ltz without timezone
.At this point, if thequeries/function_make_timestamp_ltz.json
,queries/function_make_timestamp_ltz.proto.bin
andexplain-results/function_make_timestamp_ltz.explain
files offunction_make_timestamp_ltz
are already in the commit, and there are many of these files, we generally do not notice the above problem, which leads to the incorrect submission ofqueries/function_make_timestamp_ltz.json
,queries/function_make_timestamp_ltz.proto.bin
andexplain-results/function_make_timestamp_ltz.explain
files without any impact on UT. These files are redundant.Clear and update some redundant files submitted incorrectly
Why are the changes needed?
Make code clear.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Pass GA.