-
Notifications
You must be signed in to change notification settings - Fork 73
parseExperimentalUuid
in ParserOptions
#1306
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
Open
Jolanrensen
wants to merge
1
commit into
master
Choose a base branch
from
parseExperimentalUuid
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,12 @@ public interface GlobalParserOptions { | |
public val nulls: Set<String> | ||
|
||
public val skipTypes: Set<KType> | ||
|
||
/** | ||
* Whether to allow parsing UUIDs to the experimental [kotlin.uuid.Uuid] type. | ||
* By default, this is false and UUIDs are not recognized. | ||
*/ | ||
public var parseExperimentalUuid: Boolean | ||
} | ||
|
||
/** | ||
|
@@ -101,6 +107,8 @@ public interface GlobalParserOptions { | |
* @param skipTypes a set of types that should be skipped during parsing. Parsing will be attempted for all other types. | ||
* By default, it's an empty set. To skip all types except a specified one, use [convertTo] instead. | ||
* @param useFastDoubleParser whether to use [FastDoubleParser], defaults to `true`. Please report any issues you encounter. | ||
* @param parseExperimentalUuid whether to allow parsing UUIDs to the experimental [kotlin.uuid.Uuid] type. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we now know that in notebooks dataframe properties with such type require additional opt in! |
||
* By default, this is false and UUIDs are not recognized. | ||
*/ | ||
public class ParserOptions( | ||
public val locale: Locale? = null, | ||
|
@@ -110,8 +118,31 @@ public class ParserOptions( | |
public val nullStrings: Set<String>? = null, | ||
public val skipTypes: Set<KType>? = null, | ||
public val useFastDoubleParser: Boolean? = null, | ||
public val parseExperimentalUuid: Boolean? = null, | ||
) { | ||
|
||
/** For binary compatibility. */ | ||
@Deprecated( | ||
message = PARSER_OPTIONS, | ||
level = DeprecationLevel.HIDDEN, | ||
) | ||
public constructor( | ||
locale: Locale? = null, | ||
dateTimeFormatter: DateTimeFormatter? = null, | ||
dateTimePattern: String? = null, | ||
nullStrings: Set<String>? = null, | ||
skipTypes: Set<KType>? = null, | ||
useFastDoubleParser: Boolean? = null, | ||
) : this( | ||
locale = locale, | ||
dateTimeFormatter = dateTimeFormatter, | ||
dateTimePattern = dateTimePattern, | ||
nullStrings = nullStrings, | ||
skipTypes = skipTypes, | ||
useFastDoubleParser = useFastDoubleParser, | ||
parseExperimentalUuid = null, | ||
) | ||
|
||
/** For binary compatibility. */ | ||
@Deprecated( | ||
message = PARSER_OPTIONS, | ||
|
@@ -129,7 +160,31 @@ public class ParserOptions( | |
nullStrings = nullStrings, | ||
skipTypes = null, | ||
useFastDoubleParser = null, | ||
parseExperimentalUuid = null, | ||
) | ||
|
||
/** For binary compatibility. */ | ||
@Deprecated( | ||
message = PARSER_OPTIONS_COPY, | ||
level = DeprecationLevel.HIDDEN, | ||
) | ||
public fun copy( | ||
locale: Locale? = this.locale, | ||
dateTimeFormatter: DateTimeFormatter? = this.dateTimeFormatter, | ||
dateTimePattern: String? = this.dateTimePattern, | ||
nullStrings: Set<String>? = this.nullStrings, | ||
skipTypes: Set<KType>? = this.skipTypes, | ||
useFastDoubleParser: Boolean? = this.useFastDoubleParser, | ||
): ParserOptions = | ||
ParserOptions( | ||
locale = locale, | ||
dateTimeFormatter = dateTimeFormatter, | ||
dateTimePattern = dateTimePattern, | ||
nullStrings = nullStrings, | ||
skipTypes = skipTypes, | ||
useFastDoubleParser = useFastDoubleParser, | ||
parseExperimentalUuid = null, | ||
) | ||
|
||
/** For binary compatibility. */ | ||
@Deprecated( | ||
|
@@ -149,6 +204,7 @@ public class ParserOptions( | |
nullStrings = nullStrings, | ||
skipTypes = skipTypes, | ||
useFastDoubleParser = useFastDoubleParser, | ||
parseExperimentalUuid = null, | ||
) | ||
|
||
internal fun getDateTimeFormatter(): DateTimeFormatter? = | ||
|
@@ -166,6 +222,7 @@ public class ParserOptions( | |
nullStrings: Set<String>? = this.nullStrings, | ||
skipTypes: Set<KType>? = this.skipTypes, | ||
useFastDoubleParser: Boolean? = this.useFastDoubleParser, | ||
parseExperimentalUuid: Boolean? = this.parseExperimentalUuid, | ||
): ParserOptions = | ||
ParserOptions( | ||
locale = locale, | ||
|
@@ -174,6 +231,7 @@ public class ParserOptions( | |
nullStrings = nullStrings, | ||
skipTypes = skipTypes, | ||
useFastDoubleParser = useFastDoubleParser, | ||
parseExperimentalUuid = parseExperimentalUuid, | ||
) | ||
|
||
override fun equals(other: Any?): Boolean { | ||
|
@@ -188,6 +246,7 @@ public class ParserOptions( | |
if (dateTimePattern != other.dateTimePattern) return false | ||
if (nullStrings != other.nullStrings) return false | ||
if (skipTypes != other.skipTypes) return false | ||
if (parseExperimentalUuid != other.parseExperimentalUuid) return false | ||
|
||
return true | ||
} | ||
|
@@ -199,11 +258,12 @@ public class ParserOptions( | |
result = 31 * result + (dateTimePattern?.hashCode() ?: 0) | ||
result = 31 * result + (nullStrings?.hashCode() ?: 0) | ||
result = 31 * result + (skipTypes?.hashCode() ?: 0) | ||
result = 31 * result + (parseExperimentalUuid?.hashCode() ?: 0) | ||
return result | ||
} | ||
|
||
override fun toString(): String = | ||
"ParserOptions(locale=$locale, dateTimeFormatter=$dateTimeFormatter, dateTimePattern=$dateTimePattern, nullStrings=$nullStrings, skipTypes=$skipTypes, useFastDoubleParser=$useFastDoubleParser)" | ||
"ParserOptions(locale=$locale, dateTimeFormatter=$dateTimeFormatter, dateTimePattern=$dateTimePattern, nullStrings=$nullStrings, skipTypes=$skipTypes, useFastDoubleParser=$useFastDoubleParser, parseExperimentalUuid=$parseExperimentalUuid)" | ||
} | ||
|
||
/** @include [tryParseImpl] */ | ||
|
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
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
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
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.
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.
Btw, do you plan to later rename this property later? It will be an incompatible change.. Or drop it completely? Should we call it "parseUuid" and provide note about experimental status in kdocs?