Skip to content

Conversation

@younggyuchun
Copy link

What changes were proposed in this pull request?

This PR aims to support java.sql.Time with an associated TimeType.

Why are the changes needed?

Several RDBMSes support the TIME data type. The TIME data type accepts time value; for example, 07:30:00.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass the Jenkins

@SparkQA
Copy link

SparkQA commented Jun 18, 2020

Test build #124216 has finished for PR 28858 at commit be53ff6.

  • This patch fails Spark unit tests.
  • This patch does not merge cleanly.
  • This patch adds the following public classes (experimental):
  • abstract class CastBase extends UnaryExpression with TimeZoneAwareExpression with NullIntolerant

@Stable
class TimeType private() extends AtomicType {
/**
* Internally, a timestamp is stored as the number of microseconds from
Copy link
Member

Choose a reason for hiding this comment

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

timestamp -> time?


/**
* The companion case object and its class is separated so the companion object also subclasses
* the TimestampType class. Otherwise, the companion object would be of type "TimestampType$"
Copy link
Member

Choose a reason for hiding this comment

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

TimestampType -> TimeType?
TimestampType$ -> TimeType$?

// January 1, 1970, 00:00:00 GMT for "9999-12-31 23:59:59.999999".
milliseconds = rand.nextLong() % 253402329599999L
}
// DateTimeUtils.toJavaTime takes microsecond.
Copy link
Member

Choose a reason for hiding this comment

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

takes microsecond? It seems that milliseconds is passed.

.add("date", DateType)
.add("timestamp", TimestampType)
.add("udt", new ExamplePointUDT))
// .add("null", NullType)
Copy link
Member

Choose a reason for hiding this comment

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

? Please revert this commenting out.

@dongjoon-hyun
Copy link
Member

Hi, @younggyuchun . Could you resolve conflicts?

@younggyuchun
Copy link
Author

@dongjoon-hyun
I don't expect that someone will see WIP merge request :). Yeah, of course, I will fix the merge conflicts and issues. Thank you

younggyu chun added 2 commits June 18, 2020 12:19
# Conflicts:
#	sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala
#	sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
#	sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
#	sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGenerator.scala
#	sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
#	sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
@younggyuchun younggyuchun marked this pull request as draft June 18, 2020 16:27
@SparkQA
Copy link

SparkQA commented Jun 18, 2020

Test build #124223 has finished for PR 28858 at commit d172dd4.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • class SQLQueryTestSuite extends QueryTest with SharedSparkSession with SQLHelper

Copy link
Member

@MaxGekk MaxGekk left a comment

Choose a reason for hiding this comment

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

Please, take a look at #25678 and the reasons why I closed it.

DateType,
TimestampType
TimestampType,
TimeType
Copy link
Member

Choose a reason for hiding this comment

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

Problem is that you have to define the mapping for PySpark and SparkR too that's probably one of the tricky part.
I think it's best to loop the dev mailing list and see if there's a big support for this. Otherwise, I'm not super supportive of it due to the maintenance cost.

@younggyuchun
Copy link
Author

Please, take a look at #25678 and the reasons why I closed it.

Hi @MaxGekk
Thank you for your comment. I haven't noticed that there was a discussion on TimeType. I read through #25678 but not sure if we should close this PR or not. Can you confirm that?

CC @dongjoon-hyun @HyukjinKwon

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Jun 19, 2020

Oh, right. This was tried by @MaxGekk before and concluded by the following comment by @rxin .

In this case, we had better close this. Sorry about that, @younggyuchun .

@dongjoon-hyun
Copy link
Member

Gentle ping, @younggyuchun .

@younggyuchun
Copy link
Author

younggyuchun commented Jun 22, 2020

@dongjoon-hyun Thank you for your comment. Don't be sorry there are tons of work :).
should we close these tickets too?
https://issues.apache.org/jira/browse/SPARK-27148
https://issues.apache.org/jira/browse/SPARK-7101

@dongjoon-hyun
Copy link
Member

Thanks. Yes. +1 for closing them with this and previous reference.

@MaxGekk
Copy link
Member

MaxGekk commented Feb 13, 2025

I sent the SPIP https://issues.apache.org/jira/browse/SPARK-51162 to dev list for discussion (link). @younggyuchun @dongjoon-hyun @HyukjinKwon Please, leave comments in the thread if you are still interested in the feature.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants