[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-26 Thread mgaido91
Github user mgaido91 closed the pull request at:

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


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread mgaido91
Github user mgaido91 commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309404
  
--- Diff: python/pyspark/sql/functions.py ---
@@ -793,12 +793,12 @@ def ntile(n):
 # -- Date/Timestamp functions 
--
 
 @since(1.5)
-def current_date():
+def current_date(timeZone=None):
--- End diff --

Honestly I have no idea too.. Do you know who can we ask to? Thanks.


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread mgaido91
Github user mgaido91 commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309376
  
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2508,6 +2508,14 @@ object functions {
   def current_date(): Column = withExpr { CurrentDate() }
 
   /**
+   * Returns the current date in the given timezone as a date column.
--- End diff --

this is consistent with all the other functions in this file.


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread mgaido91
Github user mgaido91 commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309394
  
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2508,6 +2508,14 @@ object functions {
   def current_date(): Column = withExpr { CurrentDate() }
 
   /**
+   * Returns the current date in the given timezone as a date column.
+   *
+   * @group datetime_funcs
+   * @since 2.3.0
+   */
+  def current_date(timeZone: String): Column = withExpr { 
CurrentDate(Option(timeZone)) }
--- End diff --

What if someone pass a `null` as value? `Option` is safer in this case...


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread jaceklaskowski
Github user jaceklaskowski commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309272
  
--- Diff: python/pyspark/sql/functions.py ---
@@ -793,12 +793,12 @@ def ntile(n):
 # -- Date/Timestamp functions 
--
 
 @since(1.5)
-def current_date():
+def current_date(timeZone=None):
--- End diff --

Would the change beg a different `@since`? It's no longer true that it 
existed `since(1.5)`, is it? Just asking...no idea how it really should be.


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread jaceklaskowski
Github user jaceklaskowski commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309246
  
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2508,6 +2508,14 @@ object functions {
   def current_date(): Column = withExpr { CurrentDate() }
 
   /**
+   * Returns the current date in the given timezone as a date column.
+   *
+   * @group datetime_funcs
+   * @since 2.3.0
+   */
+  def current_date(timeZone: String): Column = withExpr { 
CurrentDate(Option(timeZone)) }
--- End diff --

s/`Option`/`Some`


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread jaceklaskowski
Github user jaceklaskowski commented on a diff in the pull request:

https://github.com/apache/spark/pull/19261#discussion_r139309261
  
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/functions.scala ---
@@ -2508,6 +2508,14 @@ object functions {
   def current_date(): Column = withExpr { CurrentDate() }
 
   /**
+   * Returns the current date in the given timezone as a date column.
--- End diff --

`@return`?


---

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



[GitHub] spark pull request #19261: [SPARK-22040] Add current_date function with time...

2017-09-17 Thread mgaido91
GitHub user mgaido91 opened a pull request:

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

[SPARK-22040] Add current_date function with timezone id

## What changes were proposed in this pull request?

Add current_date function with timezone id.

## How was this patch tested?

Manual test on spark-shell and pyspark.


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

$ git pull https://github.com/mgaido91/spark SPARK-22040

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

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


commit 09a3ed93edf6aa44fb71b14c1194edac76f5b098
Author: Marco Gaido 
Date:   2017-09-17T12:11:20Z

[SPARK-22040] Add current_date(timezone) function




---

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