Uh oh!
There was an error while loading. Please reload this page.
[SPARK-22157] [SQL] The uniux_timestamp method handles the time field that is lost in mill - #19380
[SPARK-22157] [SQL] The uniux_timestamp method handles the time field that is lost in mill#19380httfighter wants to merge 1 commit into
Conversation
srowen
left a comment
There was a problem hiding this comment.
I think this has problems in many ways. You're treating dates as doubles and hard-coding some locale-specific concerns. But mostly, this is the wrong answer because the UNIX timestamp is in whole seconds
AmplabJenkins
commented
Sep 28, 2017
Can one of the admins verify this patch? |
httfighter
commented
Sep 29, 2017
In RDMS , unix_timestamp method can keep the milliseconds. For example, execute the command as follows |
| Seq(TypeCollection(StringType, DateType, TimestampType), StringType) | ||
| override def dataType: DataType = LongType | ||
| override def dataType: DataType = DoubleType |
There was a problem hiding this comment.
BTW, I think we can't just change this datatype directly. This could break backward compatibility.
ouyangxiaochen
commented
Sep 29, 2017
Since the RDMS keep the milliseconds, we should follow it. This proposal LGTM. @gatorsmile CC |
We also have As @HyukjinKwon said, we also need to not break backward compatibility. Btw, for RDMS support, I only found MySQL has direct unix_timestamp support like this. Sounds like not a good idea to break backward compatibility just for following one (or few) RDMS. |
srowen
commented
Sep 29, 2017
This would break compatibility with Spark and other engines like Hive. This shoudl be closed. |
ouyangxiaochen
commented
Sep 29, 2017
In fact, there are many scenarios that need to be accurate to milliseconds, should we try to solve this problem together? |
gatorsmile
commented
Sep 29, 2017
The workaround is to let users write a UDF to handle these cases |
httfighter
commented
Sep 30, 2017
I understand everyone's worries.But i hava few thoughts. |
gatorsmile
commented
Sep 30, 2017
Currently, we are following Hive for these built-in functions. See https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF Maybe we can wait and see whether more users have the same requests? Then, we can see whether we should introduce new functions or introduce a SQLConf. |
srowen
commented
Sep 30, 2017
This itself is certainly not a bug. The type is on purpose and certainly the answer is correct given the type. You are arguing for a new function called something else but you can also do this with a UDF |
I'd close this for now and optionally we could ask this case and discuss in the mailing list if this is important. |
Closesapache#11494Closesapache#14158Closesapache#16803Closesapache#16864Closesapache#17455Closesapache#17936Closesapache#19377 Added: Closesapache#19380Closesapache#18642Closesapache#18377Closesapache#19632 Added: Closesapache#14471Closesapache#17402Closesapache#17953Closesapache#18607 Also cc srowen vanzin HyukjinKwon gatorsmile cloud-fan to see if you have other PRs to close. Author: Xingbo Jiang <xingbo.jiang@databricks.com> Closesapache#19669 from jiangxb1987/stale-prs.
What changes were proposed in this pull request?
How was this patch tested?
Add new test cases and update existing test cases
Please review http://spark.apache.org/contributing.html before opening a pull request.