Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

feat: added timeZone option#616

Closed
JorisTruong wants to merge 1 commit intodatabricks:masterfrom
JorisTruong:ISSUE-612
Closed

feat: added timeZone option#616
JorisTruong wants to merge 1 commit intodatabricks:masterfrom
JorisTruong:ISSUE-612

Conversation

@JorisTruong
Copy link
Copy Markdown
Contributor

parameters.getOrElse("wildcardColName", XmlOptions.DEFAULT_WILDCARD_COL_NAME)
val ignoreNamespace = parameters.get("ignoreNamespace").map(_.toBoolean).getOrElse(false)
val timestampFormat = parameters.get("timestampFormat")
val timeZone = parameters.getOrElse("timeZone", XmlOptions.DEFAULT_TIME_ZONE)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of exposing an option, use the value of Spark conf spark.sql.session.timeZone below. We would need to document this behavior in the README

try {
return Timestamp.from(ZonedDateTime.parse(value, format).toInstant)
return Timestamp.from(
ZonedDateTime.parse(value, format.withZone(ZoneId.of(timeZone))).toInstant
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new logic should only be applied to the custom timestamp format, not the built-in ones.
I suppose, if possible, you check to see if the pattern has a TZ and augment it with the TZ specified in spark.sql.session.timeZone if not.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants