You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/02 08:23:00 UTC

[GitHub] [spark] sathyaprakashg opened a new pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

sathyaprakashg opened a new pull request #28703:
URL: https://github.com/apache/spark/pull/28703


   ### What changes were proposed in this pull request?
   Add implicit cast option for SubtractTimestamps expression
   
   
   ### Why are the changes needed?
   Currently, this statement is failing because timestamp is passed as string. By adding implicit cast trait, it will be casted to timestamp data type automatically. 
   SELECT EXTRACT(DAY FROM NOW() - '2014-08-02 08:10:56');
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   SQL statements added to sql-tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-640580044


   It's true that Spark accepts `timestamp - interval`, so this is ambiguous.
   
   `SubtractTimestamps` is an expression that is resolved from `timestamp - timestamp`. For `timestamp - interval`, it's `TimeSub`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] bart-samwel commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
bart-samwel commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641112800


   That seems right. In theory we could allow `"string" - timestamp`, but that seems uncommon so I don't think it's worth investing time in. So let's close this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] bart-samwel commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
bart-samwel commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641874279


   It's at "resolved" now -- is there anything else to do?
   
   On Tue, Jun 9, 2020 at 8:10 PM sathyaprakashg <no...@github.com>
   wrote:
   
   > Thanks @bart-samwel <https://github.com/bart-samwel> I closed the PR.
   > Could you please help me close this ticket. I don't have access to close it
   > . https://issues.apache.org/jira/browse/SPARK-29897
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/spark/pull/28703#issuecomment-641483924>, or
   > unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AKOBKFCVCONQ2VR54MFNRZTRVZ3JDANCNFSM4NQQAWXA>
   > .
   >
   
   
   -- 
   Bart Samwel
   bart.samwel@databricks.com
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641030865


   Can one of the admins verify this patch?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg edited a comment on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg edited a comment on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-640384737


   @bart-samwel  If you are referring to two test new statements i added, both are actually having timestamp in both left and right expression and returns interval. So, we have only one type, which is 
   `timestamp - timestamp returns interval`
   In the SubtractTimestamps case class we can see input date types for both left and right expressions are timestamp
   `override def inputTypes: Seq[AbstractDataType] = Seq(TimestampType, TimestampType)`


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] maropu commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
maropu commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-640951706


   (Probably, not `TimeSub` but `TimeAdd` ;)  https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L281)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] cloud-fan commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
cloud-fan commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641892277


   Yea I've already closed it as "Won't do", we are fine now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-639285650


   @cloud-fan Need your help in reviewing this PR :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-637377768


   Can one of the admins verify this patch?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-640384737


   @bart-samwel  If you are referring to two test new statements i added, both are actually having timestamp in both left and right expression and returns interval. So, we have only one type, which is 
   timestamp - timestamp returns interval


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg closed pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg closed pull request #28703:
URL: https://github.com/apache/spark/pull/28703


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641075311


   @bart-samwel @cloud-fan @maropu 
   
   In case of subtract use case, If left expression is string and right expression is timestamp, then there is no ambiguity. Timestamp is the only data type possible for left expression.
   
   But, if left expression is timestamp and right expression is string, then right expression could be timestamp or interval. So, there is ambiguity.
   
   So, if that is the reason why we used ExpectsInputTypes instead of ImplicitCastInputTypes in SubtractTimestamps then we could close this PR. 
   
   Please let me know your comments


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-637377768


   Can one of the admins verify this patch?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-637376943


   Can one of the admins verify this patch?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] bart-samwel edited a comment on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
bart-samwel edited a comment on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-639451001


   Isn't this ambiguous? You have:
   
   `timestamp - interval` returns `timestamp`
   `timestamp - timestamp` returns `interval`
   
   So the second argument could be a timestamp or an interval. (I haven't checked that we support both of these, but even if we don't support one of these now, we might add that support in the future.)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] sathyaprakashg commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
sathyaprakashg commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-641483924


   Thanks @bart-samwel I closed the PR. Could you please help me close this ticket. I don't have access to close it . https://issues.apache.org/jira/browse/SPARK-29897


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] bart-samwel commented on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
bart-samwel commented on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-639451001


   Isn't this ambiguous? You have:
   
   <timestamp> - <interval> returns <timestamp>
   <timestamp> - <timestamp> returns <interval>
   
   So the second argument could be a timestamp or an interval. (I haven't checked that we support both of these, but even if we don't support one of these now, we might add that support in the future.)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28703: SPARK-29897 Add implicit cast for SubtractTimestamps

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28703:
URL: https://github.com/apache/spark/pull/28703#issuecomment-637376943


   Can one of the admins verify this patch?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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