You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Kumar sp <kr...@gmail.com> on 2019/03/25 18:35:53 UTC

Window function range between

Hi,

I am trying to use range between window function but i am keep on getting
below error

main" org.apache.spark.sql.AnalysisException: Window Frame
specifiedwindowframe(RangeFrame, currentrow$(), 5) must match the required
frame specified

I need to check next consecutive 5 seconds interval records. Below is my
window definition

val window = Window.orderBy("date").rangeBetween(0,5)

Request to help if i am missing some thing here.


Regards,

Kumar

Re: Window function range between

Posted by Mich Talebzadeh <mi...@gmail.com>.
Hi,

This works for me

scala> val wSpec3 =
Window.partitionBy('priceInfo.getItem("ticker")).orderBy('priceInfo.getItem("timeissued").desc).rangeBetween(0,5)
wSpec3: org.apache.spark.sql.expressions.WindowSpec =
org.apache.spark.sql.expressions.WindowSpec@f308c09

HTH,

Is the date format correct. It is better to refer to date column as

val window = Window.orderBy(*'date*).rangeBetween(0,5) HTH,

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com


*Disclaimer:* Use it at your own risk. Any and all responsibility for any
loss, damage or destruction of data or any other property which may arise
from relying on this email's technical content is explicitly disclaimed.
The author will in no case be liable for any monetary damages arising from
such loss, damage or destruction.




On Mon, 25 Mar 2019 at 18:41, Kumar sp <kr...@gmail.com> wrote:

> Hi,
>
> I am trying to use range between window function but i am keep on getting
> below error
>
> main" org.apache.spark.sql.AnalysisException: Window Frame
> specifiedwindowframe(RangeFrame, currentrow$(), 5) must match the required
> frame specified
>
> I need to check next consecutive 5 seconds interval records. Below is my
> window definition
>
> val window = Window.orderBy("date").rangeBetween(0,5)
>
> Request to help if i am missing some thing here.
>
>
> Regards,
>
> Kumar
>
>