You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2017/05/08 17:16:37 UTC

[GitHub] spark pull request #17901: [SPARK-20639][SQL] Add single argument support fo...

GitHub user HyukjinKwon opened a pull request:

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

    [SPARK-20639][SQL] Add single argument support for to_timestamp in SQL with documentation improvement

    ## What changes were proposed in this pull request?
    
    This PR proposes two things as below:
    
    - Support single argument for `to_timestamp` similarly with APIs in other languages.
    
      For example, the one below works
    
      ```
      import org.apache.spark.sql.functions._
      Seq("2016-12-31 00:12:00.00").toDF("a").select(to_timestamp(col("a"))).show()
      ```
    
      prints
    
      ```
      +----------------------------------------+
      |to_timestamp(`a`, 'yyyy-MM-dd HH:mm:ss')|
      +----------------------------------------+
      |                     2016-12-31 00:12:00|
      +----------------------------------------+
      ```
    
      whereas this does not work in SQL.
    
      **Before**
    
      ```
      spark-sql> SELECT to_timestamp('2016-12-31 00:12:00.00');
      Error in query: Invalid number of arguments for function to_timestamp; line 1 pos 7
      ```
    
      **After**
    
      ```  
      spark-sql> SELECT to_timestamp('2016-12-31 00:12:00.00');
      2016-12-31 00:12:00
      ```
    
    
    - Related document improvement for SQL function descriptions and other API descriptions accordingly.
    
    
      **Before**
    
      ```
      spark-sql> DESCRIBE FUNCTION extended to_date;
      ...
      Usage: to_date(date_str, fmt) - Parses the `left` expression with the `fmt` expression. Returns null with invalid input.
      Extended Usage:
          Examples:
            > SELECT to_date('2016-12-31', 'yyyy-MM-dd');
             2016-12-31
      ```
    
      ```
      spark-sql> DESCRIBE FUNCTION extended to_timestamp;
      ...
      Usage: to_timestamp(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.
      Extended Usage:
          Examples:
            > SELECT to_timestamp('2016-12-31', 'yyyy-MM-dd');
             2016-12-31 00:00:00.0
      ```
    
      **After**
    
      ```
      spark-sql> DESCRIBE FUNCTION extended to_date;
      ...
      Usage:
          to_date(date_str[, fmt]) - Parses the `date_str` expression with the `fmt` expression.
            Casts the `date_str` into a date if `fmt` is not given. Returns null with invalid input.
    
      Extended Usage:
          Examples:
            > SELECT to_date('2009-07-30 04:17:52');
             2009-07-30
            > SELECT to_date('2016-12-31', 'yyyy-MM-dd');
             2016-12-31
      ```
    
      ```
      spark-sql> DESCRIBE FUNCTION extended to_timestamp;
      ...
      Usage:
          to_timestamp(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
            a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    
      Extended Usage:
          Examples:
            > SELECT to_timestamp('2016-12-31 00:12:00.00');
             2016-12-31 00:12:00.0
            > SELECT to_timestamp('2016-12-31', 'yyyy-MM-dd');
             2016-12-31 00:00:00.0
      ```
    
    ## How was this patch tested?
    
    Added tests in `datetime.sql`.

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

    $ git pull https://github.com/HyukjinKwon/spark to_timestamp_arg

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

    https://github.com/apache/spark/pull/17901.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 #17901
    
----
commit 9fcf1071cfe0693b67fb6e6cbec5a1bf808dd873
Author: hyukjinkwon <gu...@gmail.com>
Date:   2017-05-08T16:53:53Z

    Add single argument support for to_timestamp in SQL with documentation improvement

----


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76673 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76673/testReport)** for PR 17901 at commit [`b038927`](https://github.com/apache/spark/commit/b03892780f182e8cd08fe976f3e17ec65e71ab74).


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76641/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76585 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76585/testReport)** for PR 17901 at commit [`45bf353`](https://github.com/apache/spark/commit/45bf353866991248773ae2e59cc3951f93111189).
     * This patch **fails from timeout after a configured wait of \`250m\`**.
     * 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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115310837
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    Also, it seems we documented them here and there https://github.com/apache/spark/blob/f21897fc157ce467f2b2edb5631b31787883accd/R/pkg/R/functions.R#L1835 in Python and https://github.com/apache/spark/blob/63d90e7da4913917982c0501d63ccc433a9b6b46/python/pyspark/sql/functions.py#L1014 in R
    
    If the suggestion can be simply done with the format in `SimpleDateFormat` but in a quick look, it is not. Do you mind if we try this later in a separate PR?


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76603 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76603/testReport)** for PR 17901 at commit [`b2d3b0a`](https://github.com/apache/spark/commit/b2d3b0a39594ed6fde664ba0e754779c1278c4f9).
     * This patch **fails SparkR unit 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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76585/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    retest this please


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r116160628
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
    @@ -2683,13 +2683,12 @@ object functions {
       def unix_timestamp(s: Column, p: String): Column = withExpr { UnixTimestamp(s.expr, Literal(p)) }
     
       /**
    -   * Convert time string to a Unix timestamp (in seconds).
    -   * Uses the pattern "yyyy-MM-dd HH:mm:ss" and will return null on failure.
    +   * Convert time string to a Unix timestamp (in seconds) by casting rules to `TimestampType`.
        * @group datetime_funcs
        * @since 2.2.0
        */
       def to_timestamp(s: Column): Column = withExpr {
    -    new ParseToTimestamp(s.expr, Literal("yyyy-MM-dd HH:mm:ss"))
    --- End diff --
    
    @rxin and @cloud-fan, I would rather take out the change here if this holds off this PR. This is  essentially orthogonal with this PR. 


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115406526
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1752,15 +1752,15 @@ setMethod("toRadians",
     
     #' to_date
     #'
    -#' Converts the column into a DateType. You may optionally specify a format
    +#' Converts the column into a date column. You may optionally specify a format
     #' according to the rules in:
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a date if the format is omitted.
    --- End diff --
    
    Ah, let me give a shot with adding an example - `cast(df$x, "date")`.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76585 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76585/testReport)** for PR 17901 at commit [`45bf353`](https://github.com/apache/spark/commit/45bf353866991248773ae2e59cc3951f93111189).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115309727
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    Postgres has a single-argument to_timestamp function, but that is used to convert Unix epoch to timestamp. 


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76586/
    Test FAILed.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

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


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76641 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76641/testReport)** for PR 17901 at commit [`fc02460`](https://github.com/apache/spark/commit/fc02460c5d014c573631f3b62cd6b62f5a46c261).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115397915
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -144,12 +144,6 @@ def _():
                    'measured in radians.',
     }
     
    -_functions_2_2 = {
    -    'to_date': 'Converts a string date into a DateType using the (optionally) specified format.',
    -    'to_timestamp': 'Converts a string timestamp into a timestamp type using the ' +
    -                    '(optionally) specified format.',
    -}
    -
    --- End diff --
    
    actually, instead of deleting this we should keep it and we should add
    ```
    for _name, _doc in _functions_2_2.items():
        globals()[_name] = since(2.2)(_create_function(_name, _doc))
    ```
    this is for doc tag


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76583 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76583/testReport)** for PR 17901 at commit [`9fcf107`](https://github.com/apache/spark/commit/9fcf1071cfe0693b67fb6e6cbec5a1bf808dd873).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115303310
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1148,13 +1148,6 @@ case class ToUTCTimestamp(left: Expression, right: Expression)
     /**
      * Returns the date part of a timestamp or string.
      */
    -@ExpressionDescription(
    -  usage = "_FUNC_(expr) - Extracts the date part of the date or timestamp expression `expr`.",
    -  extended = """
    -    Examples:
    -      > SELECT _FUNC_('2009-07-30 04:17:52');
    -       2009-07-30
    -  """)
    --- End diff --
    
    This seems not used.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115309578
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    We already use this as default format in other APIs - https://github.com/apache/spark/blob/500436b4368207db9e9b9cef83f9c11d33e31e1a/sql/core/src/main/scala/org/apache/spark/sql/functions.scala#L2692
    
    Do you have any suggestion that I could try?


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76603/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76586 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76586/testReport)** for PR 17901 at commit [`f8921f4`](https://github.com/apache/spark/commit/f8921f4541422f3cd26f0cde6d7c0e2640f29c80).
     * This patch **fails PySpark unit 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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76586 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76586/testReport)** for PR 17901 at commit [`f8921f4`](https://github.com/apache/spark/commit/f8921f4541422f3cd26f0cde6d7c0e2640f29c80).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115403383
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    Sure, let me give a shot.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115401280
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    shall we follow `to_date` and using the casting rules if the format is not specified?


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115308385
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    Here, you are assuming the default format is ISO. There are at least four common default formats, EUR, ISO, JIS and USA. Normally, the database has a register to store the default format. We cannot simply assume ISO is favorite for all the users.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76584 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76584/testReport)** for PR 17901 at commit [`9f75b4c`](https://github.com/apache/spark/commit/9f75b4c5cf261b9aa3d16c911e7e025503f5a0c3).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115303244
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -144,12 +144,6 @@ def _():
                    'measured in radians.',
     }
     
    -_functions_2_2 = {
    -    'to_date': 'Converts a string date into a DateType using the (optionally) specified format.',
    -    'to_timestamp': 'Converts a string timestamp into a timestamp type using the ' +
    -                    '(optionally) specified format.',
    -}
    -
    --- End diff --
    
    This seems not used.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76583/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    you can rebase to pick up the fix for the R tests


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115309254
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    Below is a few ref
    Oracle: https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions193.htm



---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76584 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76584/testReport)** for PR 17901 at commit [`9f75b4c`](https://github.com/apache/spark/commit/9f75b4c5cf261b9aa3d16c911e7e025503f5a0c3).
     * This patch **fails PySpark unit 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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115401951
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -144,12 +144,6 @@ def _():
                    'measured in radians.',
     }
     
    -_functions_2_2 = {
    -    'to_date': 'Converts a string date into a DateType using the (optionally) specified format.',
    -    'to_timestamp': 'Converts a string timestamp into a timestamp type using the ' +
    -                    '(optionally) specified format.',
    -}
    -
    --- End diff --
    
    in fact, we might need this as a standalone fix for 2.2


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115397690
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1752,15 +1752,15 @@ setMethod("toRadians",
     
     #' to_date
     #'
    -#' Converts the column into a DateType. You may optionally specify a format
    +#' Converts the column into a date column. You may optionally specify a format
     #' according to the rules in:
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a date if the format is omitted.
     #'
     #' @param x Column to parse.
    -#' @param format string to use to parse x Column to DateType. (optional)
    +#' @param format string to use to parse x column to a date column. (optional)
    --- End diff --
    
    `Column` is a type in R, so it's intentional to captialize 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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76636/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115404224
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1752,15 +1752,15 @@ setMethod("toRadians",
     
     #' to_date
     #'
    -#' Converts the column into a DateType. You may optionally specify a format
    +#' Converts the column into a date column. You may optionally specify a format
     #' according to the rules in:
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a date if the format is omitted.
    --- End diff --
    
    Actually, I am not sure if i should write out all the contents above ...  these format above look actually a bit informal to me (dose anyone know I understood this correctly?) for a use of documentation. Do you have any good idea for a better description maybe ... ? Let me leave another comment while addressing the comments if I come up with a better idea.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115312776
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    I do understand your concern but I am not introducing the default value. It is already there in coressponding APIs.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115402276
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -144,12 +144,6 @@ def _():
                    'measured in radians.',
     }
     
    -_functions_2_2 = {
    -    'to_date': 'Converts a string date into a DateType using the (optionally) specified format.',
    -    'to_timestamp': 'Converts a string timestamp into a timestamp type using the ' +
    -                    '(optionally) specified format.',
    -}
    -
    --- End diff --
    
    Up to my knowledge, these were for defining single argumented function that takes a column conveniently but we are defining them below already and both look taking additional format argument. Finally both look having the annotatioms correctly.
    
    Let me double check and address this comment if possible.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76673 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76673/testReport)** for PR 17901 at commit [`b038927`](https://github.com/apache/spark/commit/b03892780f182e8cd08fe976f3e17ec65e71ab74).
     * 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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    @gatorsmile and @hvanhovell, I am not introducing the default value but using the same default value already there that we documented here and there.
    
    This PR simply supports single-argument in `to_timestamp` function in SQL consistently with the same corresponding `to_timestamp` functions within Spark.
    
    Changing the default value sounds orthogonal to me and does not look blocking this PR.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115397799
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1827,15 +1827,15 @@ setMethod("to_json", signature(x = "Column"),
     
     #' to_timestamp
     #'
    -#' Converts the column into a TimestampType. You may optionally specify a format
    +#' Converts the column into a timestamp column. You may optionally specify a format
    --- End diff --
    
    Is there more info on `timestamp column`? as it was, `TimestampType` we could say or reference the Scala/Spark type


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76583 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76583/testReport)** for PR 17901 at commit [`9fcf107`](https://github.com/apache/spark/commit/9fcf1071cfe0693b67fb6e6cbec5a1bf808dd873).
     * This patch **fails PySpark unit 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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115397620
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1752,15 +1752,15 @@ setMethod("toRadians",
     
     #' to_date
     #'
    -#' Converts the column into a DateType. You may optionally specify a format
    +#' Converts the column into a date column. You may optionally specify a format
     #' according to the rules in:
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a date if the format is omitted.
    --- End diff --
    
    is there more info we could provide for R users, who might not know where to look for this?


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115404160
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -144,12 +144,6 @@ def _():
                    'measured in radians.',
     }
     
    -_functions_2_2 = {
    -    'to_date': 'Converts a string date into a DateType using the (optionally) specified format.',
    -    'to_timestamp': 'Converts a string timestamp into a timestamp type using the ' +
    -                    '(optionally) specified format.',
    -}
    -
    --- End diff --
    
    actually, that's right - we don't need them  - not sure if these are left behind from before `format` parameter was added or something.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    thanks, merging to master! @rxin if you have any concern about the default value, we can change it later.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76603 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76603/testReport)** for PR 17901 at commit [`b2d3b0a`](https://github.com/apache/spark/commit/b2d3b0a39594ed6fde664ba0e754779c1278c4f9).


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115670431
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
    @@ -2683,13 +2683,12 @@ object functions {
       def unix_timestamp(s: Column, p: String): Column = withExpr { UnixTimestamp(s.expr, Literal(p)) }
     
       /**
    -   * Convert time string to a Unix timestamp (in seconds).
    -   * Uses the pattern "yyyy-MM-dd HH:mm:ss" and will return null on failure.
    +   * Convert time string to a Unix timestamp (in seconds) by casting rules to `TimestampType`.
        * @group datetime_funcs
        * @since 2.2.0
        */
       def to_timestamp(s: Column): Column = withExpr {
    -    new ParseToTimestamp(s.expr, Literal("yyyy-MM-dd HH:mm:ss"))
    --- End diff --
    
    here we change the default value of the format string to be locale sensitive(same as `cast(col, timestamp)`), is it ok? cc @rxin


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76584/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    Thank you everybody. Let me ty to address the comments.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76673/
    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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76636 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76636/testReport)** for PR 17901 at commit [`497a229`](https://github.com/apache/spark/commit/497a22965af3a74e89c73b60667ab19fecb0af39).


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/17901
  
    Thank you so much.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76638 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76638/testReport)** for PR 17901 at commit [`b6f867c`](https://github.com/apache/spark/commit/b6f867cd87e46ca2daf74eabce14b735a962c9a4).


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76638/
    Test FAILed.


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Merged build finished. Test FAILed.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115312257
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    The problem is the default values we choose. I am not sure whether we should simply choose ISO as the default value.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115414505
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1757,7 +1757,8 @@ setMethod("toRadians",
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a DateType if the format is omitted
    +#' (equivalent with \code{cast(df$x, "date")}).
    --- End diff --
    
    @felixcheung, I added an example here. Would this be enough?


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76659 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76659/testReport)** for PR 17901 at commit [`fc02460`](https://github.com/apache/spark/commit/fc02460c5d014c573631f3b62cd6b62f5a46c261).


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/76659/
    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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115303033
  
    --- Diff: R/pkg/R/functions.R ---
    @@ -1752,15 +1752,15 @@ setMethod("toRadians",
     
     #' to_date
     #'
    -#' Converts the column into a DateType. You may optionally specify a format
    +#' Converts the column into a date column. You may optionally specify a format
     #' according to the rules in:
     #' \url{http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html}.
     #' If the string cannot be parsed according to the specified format (or default),
     #' the value of the column will be null.
    -#' The default format is 'yyyy-MM-dd'.
    +#' By default, it follows casting rules to a date if the format is omitted.
    --- End diff --
    
    It looks the default format is ...
    
    >    * `yyyy`,
    >    * `yyyy-[m]m`
    >    * `yyyy-[m]m-[d]d`
    >    * `yyyy-[m]m-[d]d `
    >    * `yyyy-[m]m-[d]d *`
    >    * `yyyy-[m]m-[d]dT*`
    
    https://github.com/apache/spark/blob/22691556e5f0dfbac81b8cc9ca0a67c70c1711ca/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala#L430-L435
    
    which looks used in the casting rule to a date type.


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115311054
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala ---
    @@ -1212,22 +1209,27 @@ case class ParseToDate(left: Expression, format: Option[Expression], child: Expr
     /**
      * Parses a column to a timestamp based on the supplied format.
      */
    -// scalastyle:off line.size.limit
     @ExpressionDescription(
    -  usage = "_FUNC_(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.",
    +  usage = """
    +    _FUNC_(timestamp[, fmt]) - Parses the `timestamp` expression with the `format` expression to
    +      a timestamp. Returns null with invalid input. Default `fmt` is 'yyyy-MM-dd HH:mm:ss'.
    --- End diff --
    
    cc @marmbrus @rxin @hvanhovell @cloud-fan 


---
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 #17901: [SPARK-20639][SQL] Add single argument support fo...

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

    https://github.com/apache/spark/pull/17901#discussion_r115398027
  
    --- Diff: python/pyspark/sql/functions.py ---
    @@ -987,9 +981,10 @@ def months_between(date1, date2):
     def to_date(col, format=None):
         """Converts a :class:`Column` of :class:`pyspark.sql.types.StringType` or
         :class:`pyspark.sql.types.TimestampType` into :class:`pyspark.sql.types.DateType`
    -    using the optionally specified format. Default format is 'yyyy-MM-dd'.
    -    Specify formats according to
    +    using the optionally specified format. Specify formats according to
         `SimpleDateFormats <http://docs.oracle.com/javase/tutorial/i18n/format/simpleDateFormat.html>`_.
    +    By default, it follows casting rules to :class:`pyspark.sql.types.DateType` if the format
    --- End diff --
    
    ditto, not sure if it's clear to python user with `casting rules to :class:pyspark.sql.types.DateType`


---
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 issue #17901: [SPARK-20639][SQL] Add single argument support for to_ti...

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

    https://github.com/apache/spark/pull/17901
  
    **[Test build #76659 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/76659/testReport)** for PR 17901 at commit [`fc02460`](https://github.com/apache/spark/commit/fc02460c5d014c573631f3b62cd6b62f5a46c261).
     * 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