Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Convert SQL Server Store Procedure Into Impala Code


Hi All


As I know Impala is similar to SQL but I have a requirement where need to convert SQL server Stored Procedure into Impala code. Is this possible? This procedure has more than 500 lines that have multiple temporary tables, different joins, delete, update, and dynamic SQL.


Is there any way this can be converted to Impala?



Hi @vijaysahu 


You didn't provide the version of Impala you're targeting, but assuming that what you are using is fairly recent, I would answer: Yes, it is possible, but probably not in any automated fashion.


The Impala equivalent to SQL Server Stored Procedures are called User-defined functions (or UDFs). Starting in Impala 1.2, you can code your UDFs in C++ and/or Java instead of the proprietary programming language Transact-SQL (T-SQL) commonly used in MS SQL server. You can start reading up on Impala User-defined functions here:

User-Defined Functions (UDFs)


I am not aware of any translator or "converter" that will take T-SQL code and transform it into the equivalent syntax in Java (for example) that can be used in Impala; perhaps another member of the Cloudera Community is aware of one and will weigh in here with a pointer. Even if one is available, I think you'd be better off sitting down, doing some analysis and getting an understanding of what the original procedure with the more than 500 lines of code does and then write a new UDF or set of UDFs that does the equivalent thing in Impala (there are important limitations to the functionality of UDFs that don't limit corresponding T-SQL procedures). Any competent software developer should be able to accomplish that task in a reasonable amount of time, given reasonable complexity of the original code, and probably less time than it will take you, in terms of calendar days, than it would take to acquire and learn the quirks of an automated translator. That person might decide that there are better ways of satisfying the requirements than using UDFs and that the original stored procedures never should have been written at all.



Bill Brooks, Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.