[SPARK-30509][SQL] Fix deprecation log warning in Avro schema inferring#27200
[SPARK-30509][SQL] Fix deprecation log warning in Avro schema inferring#27200MaxGekk wants to merge 5 commits intoapache:masterfrom
Conversation
|
@gengliangwang @HyukjinKwon Please, review the PR. |
|
Test build #116701 has started for PR 27200 at commit |
| .read | ||
| .format("avro") | ||
| .option(AvroOptions.ignoreExtensionKey, false) | ||
| .option("header", true) |
There was a problem hiding this comment.
Does Avro has header option?
There was a problem hiding this comment.
I copy pasted the piece of code from another test in AvroSuite:
. Let me check and remove it if is not needed.There was a problem hiding this comment.
Yeh, it is not needed. It seems the test which I copy-pasted was copy-pasted from another places. I guess from
Let me remove the option from other avro test as well.
| val deprecatedEvents = logAppender.loggingEvents | ||
| .filter(_.getRenderedMessage.contains( | ||
| s"Option ${AvroOptions.ignoreExtensionKey} is deprecated")) | ||
| assert(deprecatedEvents.size === 1) |
There was a problem hiding this comment.
Can we test if the size is just bigger then 0 just in case we have other deprecation logs later?
There was a problem hiding this comment.
I compared the size to 1 to avoid any concerns that it is printed multiple times like in the PR (#27174 (comment)), per each partition.
There was a problem hiding this comment.
If we expect it is printed only once, maybe we should assert that?
There was a problem hiding this comment.
So, if somebody modifies the code in the future in the way the warning is printed many times, we will catch the situation by the test.
There was a problem hiding this comment.
just in case we have other deprecation logs later?
As we discussed in another PR, we are not going to print any log warnings about ignoreExtension. Am I right or misunderstood something?
|
Test build #116702 has finished for PR 27200 at commit
|
There was a problem hiding this comment.
The following will match only AvroOptions.ignoreExtensionKey. So, the warnings from another deprecations will be skipped. And, the assertion seems to verify that target warning occurs once.
val deprecatedEvents = logAppender.loggingEvents
.filter(_.getRenderedMessage.contains(...)| .write | ||
| .format("avro") | ||
| .partitionBy("p1", "p2") | ||
| .option("header", true) |
There was a problem hiding this comment.
Ur, BTW, why do you piggy-back this removal into this PR?
There was a problem hiding this comment.
The change is small, since I am here I remove unneeded option. Do you want to see a separate PR for the little change?
dongjoon-hyun
left a comment
There was a problem hiding this comment.
The misleading piggy-back removal is a blocker for this PR.
This reverts commit 6c53b50.
|
@dongjoon-hyun I removed unrelated changes from this PR |
|
Test build #116723 has finished for PR 27200 at commit
|
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, LGTM back. Merged to master.
What changes were proposed in this pull request?
In the PR, I propose to check the
ignoreExtensionKeyoption in the case insensitive map ofAvroOption.Why are the changes needed?
The map
optionspassed toAvroUtils.inferSchemacontains all keys in the lower cases in fact. Actually, the map is converted from aCaseInsensitiveStringMap. Consequently, the checkspark/external/avro/src/main/scala/org/apache/spark/sql/avro/AvroUtils.scala
Line 45 in 3663dbe
false, and the deprecation log warning is never printed.Does this PR introduce any user-facing change?
Yes, after the changes the log warning is printed once.
How was this patch tested?
Added new test to
AvroSuitewhich checks existence of log warning.