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/11/05 21:27:41 UTC

[GitHub] spark pull request: [SPARK-11537] [SQL] fix negative hours/minutes...

GitHub user davies opened a pull request:

    https://github.com/apache/spark/pull/9502

    [SPARK-11537] [SQL] fix negative hours/minutes/seconds

    Currently, if the Timestamp is before epoch (1970/01/01), the hours, minutes and seconds will be negative (also rounding up).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/davies/spark neg_hour

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9502.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 #9502
    
----
commit a0bfae4cde91d202933549a7e1914af7ae6fb6e2
Author: Davies Liu <da...@databricks.com>
Date:   2015-11-05T20:24:40Z

    fix negative hours/minutes/seconds

----


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154250596
  
    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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154182513
  
    **[Test build #45142 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45142/consoleFull)** for PR 9502 at commit [`a0bfae4`](https://github.com/apache/spark/commit/a0bfae4cde91d202933549a7e1914af7ae6fb6e2).


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154250597
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45155/
    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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154219317
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45142/
    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-11537] [SQL] fix negative hours/minutes...

Posted by nongli <gi...@git.apache.org>.
Github user nongli commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44069259
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    +    us + toYearZero * MICROS_PER_DAY
    +  }
    +
    +  /**
        * Returns the hour value of a given timestamp value. The timestamp is expressed in microseconds.
        */
    -  def getHours(timestamp: SQLTimestamp): Int = {
    -    val localTs = (timestamp / 1000) + defaultTimeZone.getOffset(timestamp / 1000)
    -    ((localTs / 1000 / 3600) % 24).toInt
    +  def getHours(us: SQLTimestamp): Int = {
    +    val localTs = absoluteMicroSeconds(us) + defaultTimeZone.getOffset(us / 1000) * 1000L
    +    ((localTs / MICROS_PER_SECOND / 3600) % 24).toInt
    --- End diff --
    
    Can you define MICROS_PER_HOUR and MICROS_PER_MINUTE?


---
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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154221994
  
    **[Test build #45155 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45155/consoleFull)** for PR 9502 at commit [`8719a61`](https://github.com/apache/spark/commit/8719a614f9b2ed4c86379966fae0d338b845988f).


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154181803
  
     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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154238303
  
    **[Test build #45167 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45167/consoleFull)** for PR 9502 at commit [`a02a5c1`](https://github.com/apache/spark/commit/a02a5c1cd48969be363564aec0b6a786ee23d968).


---
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-11537] [SQL] fix negative hours/minutes...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/9502


---
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-11537] [SQL] fix negative hours/minutes...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154251060
  
    Merging this into master and 1.5, 1.6 branch.


---
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-11537] [SQL] fix negative hours/minutes...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44081728
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    +    us + toYearZero * MICROS_PER_DAY
    +  }
    +
    +  /**
        * Returns the hour value of a given timestamp value. The timestamp is expressed in microseconds.
        */
    -  def getHours(timestamp: SQLTimestamp): Int = {
    -    val localTs = (timestamp / 1000) + defaultTimeZone.getOffset(timestamp / 1000)
    -    ((localTs / 1000 / 3600) % 24).toInt
    +  def getHours(us: SQLTimestamp): Int = {
    --- End diff --
    
    I think it's clear in this context, we use it a lot in DateTimeUtils


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154181833
  
    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-11537] [SQL] fix negative hours/minutes...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44082448
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    +    us + toYearZero * MICROS_PER_DAY
    +  }
    +
    +  /**
        * Returns the hour value of a given timestamp value. The timestamp is expressed in microseconds.
        */
    -  def getHours(timestamp: SQLTimestamp): Int = {
    -    val localTs = (timestamp / 1000) + defaultTimeZone.getOffset(timestamp / 1000)
    -    ((localTs / 1000 / 3600) % 24).toInt
    +  def getHours(us: SQLTimestamp): Int = {
    --- End diff --
    
    There isn't that many. If you look at DateTimeUtils, all other units are spelled out, e.g. millis, nanoseconds.
    
    Note that the problem is that the unit is not "u". It just looks like u...



---
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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154264257
  
    **[Test build #45167 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45167/consoleFull)** for PR 9502 at commit [`a02a5c1`](https://github.com/apache/spark/commit/a02a5c1cd48969be363564aec0b6a786ee23d968).
     * 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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154235812
  
    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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154219316
  
    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-11537] [SQL] fix negative hours/minutes...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44064762
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    +    us + toYearZero * MICROS_PER_DAY
    +  }
    +
    +  /**
        * Returns the hour value of a given timestamp value. The timestamp is expressed in microseconds.
        */
    -  def getHours(timestamp: SQLTimestamp): Int = {
    -    val localTs = (timestamp / 1000) + defaultTimeZone.getOffset(timestamp / 1000)
    -    ((localTs / 1000 / 3600) % 24).toInt
    +  def getHours(us: SQLTimestamp): Int = {
    --- End diff --
    
    microsecs?


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154264363
  
    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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154219175
  
    **[Test build #45142 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45142/consoleFull)** for PR 9502 at commit [`a0bfae4`](https://github.com/apache/spark/commit/a0bfae4cde91d202933549a7e1914af7ae6fb6e2).
     * 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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154221347
  
     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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154235748
  
     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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154264365
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45167/
    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-11537] [SQL] fix negative hours/minutes...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154250482
  
    **[Test build #45155 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/45155/consoleFull)** for PR 9502 at commit [`8719a61`](https://github.com/apache/spark/commit/8719a614f9b2ed4c86379966fae0d338b845988f).
     * 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-11537] [SQL] fix negative hours/minutes...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44081664
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    +    us + toYearZero * MICROS_PER_DAY
    +  }
    +
    +  /**
        * Returns the hour value of a given timestamp value. The timestamp is expressed in microseconds.
        */
    -  def getHours(timestamp: SQLTimestamp): Int = {
    -    val localTs = (timestamp / 1000) + defaultTimeZone.getOffset(timestamp / 1000)
    -    ((localTs / 1000 / 3600) % 24).toInt
    +  def getHours(us: SQLTimestamp): Int = {
    +    val localTs = absoluteMicroSeconds(us) + defaultTimeZone.getOffset(us / 1000) * 1000L
    +    ((localTs / MICROS_PER_SECOND / 3600) % 24).toInt
    --- End diff --
    
    Those two will be only used here, I'd like not to define them.


---
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-11537] [SQL] fix negative hours/minutes...

Posted by nongli <gi...@git.apache.org>.
Github user nongli commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9502#discussion_r44069256
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala ---
    @@ -393,28 +393,35 @@ object DateTimeUtils {
       }
     
       /**
    +   * Returns the microseconds since year zero (-17999).
    +   */
    +  def absoluteMicroSeconds(us: SQLTimestamp): SQLTimestamp = {
    --- End diff --
    
    Can you comment on what the input represents? Time since what?


---
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-11537] [SQL] fix negative hours/minutes...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9502#issuecomment-154221366
  
    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