Stored Procedures in Spark

Hello Everyone,

I am migrating from SQL Server to Hive and have few stored procedures that run on SQL server.
Is it possible to write stored procedures in spark?
Would it be faster then Hive programming language ?

Also if any one can share any resource which can be used as a guide for writing stored procedure in spark that would be great.