[SPARK-29870][SQL][FOLLOW-UP] Keep CalendarInterval's toString#26572
Closed
HyukjinKwon wants to merge 3 commits into
Closed
[SPARK-29870][SQL][FOLLOW-UP] Keep CalendarInterval's toString#26572HyukjinKwon wants to merge 3 commits into
HyukjinKwon wants to merge 3 commits into
Conversation
Member
Author
|
cc @cloud-fan and @yaooqinn |
yaooqinn
reviewed
Nov 18, 2019
Member
|
LGTM, thanks for your follow-up. |
cloud-fan
reviewed
Nov 18, 2019
| private def appendUnit(sb: StringBuilder, value: Long, unit: String): Unit = { | ||
| if (value != 0) sb.append(value).append(' ').append(unit).append(' ') | ||
| } | ||
| def toMultiUnitsString(interval: CalendarInterval): String = interval.toString |
Contributor
There was a problem hiding this comment.
probably add a comment saying that the toString implementation is the multi-units format.
|
Test build #114009 has finished for PR 26572 at commit
|
srowen
reviewed
Nov 18, 2019
| (row: SpecializedGetters, ordinal: Int) => | ||
| gen.writeNumber(row.getDouble(ordinal)) | ||
|
|
||
| case CalendarIntervalType => |
Member
There was a problem hiding this comment.
This doesn't change behavior, right? same string comes out?
Member
Author
There was a problem hiding this comment.
Yup, as it will still call toString.
Member
Author
|
Last commit is comment-only (eefd457). |
Member
Author
|
Merged to master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This is a followup of #26418. This PR removed
CalendarInterval'stoStringwith an unfinished changes.Why are the changes needed?
Ideally we should make each PR isolated and separate targeting one issue without touching unrelated codes.
There are some other places where the string formats were exposed to users. For example:
Such fixes:
private def writeMapData( map: MapData, mapType: MapType, fieldWriter: ValueWriter): Unit = { val keyArray = map.keyArray() + val keyString = mapType.keyType match { + case CalendarIntervalType => + (i: Int) => IntervalUtils.toMultiUnitsString(keyArray.getInterval(i)) + case _ => (i: Int) => keyArray.get(i, mapType.keyType).toString + }can cause performance regression due to type dispatch for each map.
Does this PR introduce any user-facing change?
Yes, see 2. case above.
How was this patch tested?
Manually tested.