[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-23 Thread asfgit
Github user asfgit closed the pull request at:

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


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-22 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20031#discussion_r158481310
  
--- Diff: R/pkg/R/functions.R ---
@@ -40,10 +40,17 @@ NULL
 #'
 #' @param x Column to compute on. In \code{window}, it must be a time 
Column of
 #'  \code{TimestampType}.
-#' @param format For \code{to_date} and \code{to_timestamp}, it is the 
string to use to parse
-#'   Column \code{x} to DateType or TimestampType. For 
\code{trunc}, it is the string
-#'   to use to specify the truncation method. For example, 
"year", "", "yy" for
-#'   truncate by year, or "month", "mon", "mm" for truncate by 
month.
+#' @param format The format for the given dates or timestamps in Column 
\code{x}. See the
+#'   format used in the following methods:
+#'   \itemize{
+#'   \item \code{to_date} and \code{to_timestamp}: it is the 
string to use to parse
+#'Column \code{x} to DateType or TimestampType.
+#'   \item \code{trunc}: it is the string to use to specify 
the truncation method.
+#'For example, "year", "", "yy" for truncate by 
year, or "month", "mon",
+#'"mm" for truncate by month.
+#'   \item \code{date_trunc}: it is similar with 
\code{trunc}'s but additionally
+#'supports "day", "dd", "second", "minute", "hour", 
"week" and "quarter".
+#'   }
--- End diff --

I am fine with a single paragraph too. Please let me know if you have a 
preference @felixcheung. 


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-22 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20031#discussion_r158480821
  
--- Diff: R/pkg/R/functions.R ---
@@ -40,10 +40,17 @@ NULL
 #'
 #' @param x Column to compute on. In \code{window}, it must be a time 
Column of
 #'  \code{TimestampType}.
-#' @param format For \code{to_date} and \code{to_timestamp}, it is the 
string to use to parse
-#'   Column \code{x} to DateType or TimestampType. For 
\code{trunc}, it is the string
-#'   to use to specify the truncation method. For example, 
"year", "", "yy" for
-#'   truncate by year, or "month", "mon", "mm" for truncate by 
month.
+#' @param format The format for the given dates or timestamps in Column 
\code{x}. See the
+#'   format used in the following methods:
+#'   \itemize{
+#'   \item \code{to_date} and \code{to_timestamp}: it is the 
string to use to parse
+#'Column \code{x} to DateType or TimestampType.
+#'   \item \code{trunc}: it is the string to use to specify 
the truncation method.
+#'For example, "year", "", "yy" for truncate by 
year, or "month", "mon",
+#'"mm" for truncate by month.
+#'   \item \code{date_trunc}: it is similar with 
\code{trunc}'s but additionally
+#'supports "day", "dd", "second", "minute", "hour", 
"week" and "quarter".
+#'   }
--- End diff --

The doc looks like this: 

https://user-images.githubusercontent.com/6477701/34297427-73f4f282-e75b-11e7-9153-c1e6adbd04ff.png;>



---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-21 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/20031#discussion_r158409003
  
--- Diff: R/pkg/R/functions.R ---
@@ -41,9 +41,15 @@ NULL
 #' @param x Column to compute on. In \code{window}, it must be a time 
Column of
 #'  \code{TimestampType}.
 #' @param format For \code{to_date} and \code{to_timestamp}, it is the 
string to use to parse
-#'   Column \code{x} to DateType or TimestampType. For 
\code{trunc}, it is the string
-#'   to use to specify the truncation method. For example, 
"year", "", "yy" for
-#'   truncate by year, or "month", "mon", "mm" for truncate by 
month.
+#'   Column \code{x} to DateType or TimestampType.
+#'
--- End diff --

Yup, I am fine with fixing. Will check and fix late tomorrow.


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-21 Thread felixcheung
Github user felixcheung commented on a diff in the pull request:

https://github.com/apache/spark/pull/20031#discussion_r158371712
  
--- Diff: R/pkg/R/functions.R ---
@@ -41,9 +41,15 @@ NULL
 #' @param x Column to compute on. In \code{window}, it must be a time 
Column of
 #'  \code{TimestampType}.
 #' @param format For \code{to_date} and \code{to_timestamp}, it is the 
string to use to parse
-#'   Column \code{x} to DateType or TimestampType. For 
\code{trunc}, it is the string
-#'   to use to specify the truncation method. For example, 
"year", "", "yy" for
-#'   truncate by year, or "month", "mon", "mm" for truncate by 
month.
+#'   Column \code{x} to DateType or TimestampType.
+#'
--- End diff --

I'm pretty sure these whitespace will be stripped by roxygen2.
use item if you think that makes sense, otherwise it might be better to 
keep as a single paragraph


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #20031: [SPARK-22844][R] Adds date_trunc in R API

2017-12-20 Thread HyukjinKwon
GitHub user HyukjinKwon opened a pull request:

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

[SPARK-22844][R] Adds date_trunc in R API

## What changes were proposed in this pull request?

This PR adds `date_trunc` in R API as below:

```r
> df <- createDataFrame(list(list(a = as.POSIXlt("2012-12-13 12:34:00"
> head(select(df, date_trunc("hour", df$a)))
  date_trunc(hour, a)
1 2012-12-13 12:00:00
```

## How was this patch tested?

Unit tests added in `R/pkg/tests/fulltests/test_sparkSQL.R`.

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

$ git pull https://github.com/HyukjinKwon/spark r-datetrunc

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

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


commit c54abe9dfad3dd7447209807826e79b1682f028c
Author: hyukjinkwon 
Date:   2017-12-20T09:53:53Z

Adds date_trunc in R API




---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org