spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adline Dsilva <>
Subject RE: Window Functions with SQLContext
Date Thu, 01 Sep 2016 05:34:52 GMT
  Use function rowNumber instead of row_number

df1.withColumn("row_number", rowNumber.over(w));

From: saurabh3d []
Sent: 01 September 2016 13:16
Subject: Window Functions with SQLContext

Hi All,

As per  SPARK-11001 <>   ,
Window functions should be supported by SQLContext. But when i try to run

SQLContext sqlContext = new SQLContext(jsc);
WindowSpec w = Window.partitionBy("assetId").orderBy("assetId");
DataFrame df_2 = df1.withColumn("row_number", row_number().over(w));;

it fails with:
Exception in thread "main" org.apache.spark.sql.AnalysisException: Could not
resolve window function 'row_number'. Note that, using window functions
currently requires a HiveContext;

This code runs fine with HiveContext.
Any idea what’s going on?  Is this a known issue and is there a workaround
to make Window function work without HiveContext.


View this message in context:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe e-mail:


This e-mail (including any attachments) is for the addressee(s) only and may be confidential,
especially as regards personal data. If you are not the intended recipient, please note that
any dealing, review, distribution, printing, copying or use of this e-mail is strictly prohibited.
If you have received this email in error, please notify the sender immediately and delete
the original message (including any attachments).

MIMOS Berhad is a research and development institution under the purview of the Malaysian
Ministry of Science, Technology and Innovation. Opinions, conclusions and other information
in this e-mail that do not relate to the official business of MIMOS Berhad and/or its subsidiaries
shall be understood as neither given nor endorsed by MIMOS Berhad and/or its subsidiaries
and neither MIMOS Berhad nor its subsidiaries accepts responsibility for the same. All liability
arising from or in connection with computer viruses and/or corrupted e-mails is excluded to
the fullest extent permitted by law.

To unsubscribe e-mail:

View raw message