We don't support native UDAs at the moment in Spark SQL. You can write a UDA using Hive's API and use that within Spark SQL
On Tue, Nov 25, 2014 at 10:10 AM, Barua, Seemanto < seemanto.ba...@jpmchase.com.invalid> wrote: > Hi, > > > > I am looking for some resources/tutorials that will help me achive this: > > > > My JavaSchemaRDD is from JSON objects like below. > > How do I go about writing a UDF aggregate function let’s say ‘vectorAgg’ > which I can call from sql that returns one result array that is a > positional aggregate across all the arrays of matching json objects that > are in the select. > > > > > > { > > "vectorId": "7d27f49e-6388-11e4-9fe2-001f29ebd7e2", > > "vectorData": [ > > -1.727238, > > -0.2929525, > > -0.3537626, > > 0.240797, > > -0.1168013, > > 0.1258268, > > -0.1070271, > > 0.4877119, > > -0.06820393, > > -0.01934624, > > 0.1777821, > > 0.7428637, > > 0.0328331, > > 0.05247593, > > 0.01435089, > > 0.03089523, > > -0.1077004, > > 0.08026028, > > 0.006148338, > > -0.197648, > > 0.1349506, > > 0.5219278, > > 0.07526779, > > -0.01389027, > > 0.3850908, > > 0.06177521, > > 0.2421045, > > 0.01061058] > > } > > > > -Regards > > *Seemanto Barua* > > > > > > > > This communication is for informational purposes only. It is not intended > as an offer or solicitation for the purchase or sale of any financial > instrument or as an official confirmation of any transaction. All market > prices, data and other information are not warranted as to completeness or > accuracy and are subject to change without notice. Any comments or > statements made herein do not necessarily reflect those of JPMorgan Chase & > Co., its subsidiaries and affiliates. This transmission may contain > information that is proprietary, privileged, confidential and/or exempt > from disclosure under applicable law. If you are not the intended > recipient, you are hereby notified that any disclosure, copying, > distribution, or use of the information contained herein (including any > reliance thereon) is STRICTLY PROHIBITED. Although this transmission and > any attachments are believed to be free of any virus or other defect that > might affect any computer system into which it is received and opened, it > is the responsibility of the recipient to ensure that it is virus free and > no responsibility is accepted by JPMorgan Chase & Co., its subsidiaries and > affiliates, as applicable, for any loss or damage arising in any way from > its use. If you received this transmission in error, please immediately > contact the sender and destroy the material in its entirety, whether in > electronic or hard copy format. Thank you. Please refer to > http://www.jpmorgan.com/pages/disclosures for disclosures relating to > European legal entities. >