You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by davies <gi...@git.apache.org> on 2015/09/10 00:43:04 UTC
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
GitHub user davies opened a pull request:
https://github.com/apache/spark/pull/8674
[SPARK-10522] [SQL] Nanoseconds of Timestamp in Parquet should be positive
Or Hive can't read it back correctly.
Thanks @vanzin for report this.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davies/spark positive_nano
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/8674.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #8674
----
commit 337727f9a777352a7eaa224bf6b03135064c78f4
Author: Davies Liu <da...@databricks.com>
Date: 2015-09-09T22:41:36Z
nanoseconds should be positive
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39107831
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
ok. I'll close my PR and leave the bug open.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139067875
LGTM.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-140209264
Merged into master and 1.5 branch (added comment while merging).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39107802
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
If we throw an exception, the job will crash if there are some garbage rows in it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139082368
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42221/
Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139065552
Merged build started.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139066776
[Test build #42221 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42221/consoleFull) for PR 8674 at commit [`337727f`](https://github.com/apache/spark/commit/337727f9a777352a7eaa224bf6b03135064c78f4).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139082294
[Test build #42221 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/42221/console) for PR 8674 at commit [`337727f`](https://github.com/apache/spark/commit/337727f9a777352a7eaa224bf6b03135064c78f4).
* This patch **passes all tests**.
* This patch merges cleanly.
* This patch adds no public classes.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39429841
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
How about adding some comments at here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139065523
Merged build triggered.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39107728
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
We haven't handle overflow in many places, the behavior is undefined, it means will be garbage in the file, I think it's fine for now.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-139082365
Merged build finished. Test PASSed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by yhuai <gi...@git.apache.org>.
Github user yhuai commented on the pull request:
https://github.com/apache/spark/pull/8674#issuecomment-140156564
Originally, we may have 0 at the field of nanoseconds?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39107075
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
Without the checks I'm adding in #8606 this can overflow and write garbage to the file...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/8674#discussion_r39108416
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
@@ -192,11 +193,10 @@ object DateTimeUtils {
* Returns Julian day and nanoseconds in a day from the number of microseconds
*/
def toJulianDay(us: SQLTimestamp): (Int, Long) = {
- val seconds = us / MICROS_PER_SECOND
- val day = seconds / SECONDS_PER_DAY + JULIAN_DAY_OF_EPOCH
- val secondsInDay = seconds % SECONDS_PER_DAY
- val nanos = (us % MICROS_PER_SECOND) * 1000L
- (day.toInt, secondsInDay * NANOS_PER_SECOND + nanos)
+ val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY
--- End diff --
Long (2^63) is enough for 584942 years before overflow, so don't worry about it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request: [SPARK-10522] [SQL] Nanoseconds of Timestamp i...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/8674
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org