ayesheepatra07 opened a new pull request, #15483:
URL: https://github.com/apache/pinot/pull/15483

   This change enhances error handling and display in Groovy transformation 
functions. When a Groovy script fails to compile, the error is logged into the 
controller logs and passed through the call stack.
   Changes - 
   Wrapped the call (createSafeShell(_binding).parse(scriptText))to compile the 
Groovy script in a try-catch block. When a compilation error occurs, the 
exception is now: 
   - Logged using LOGGER.error, including the full stack trace and original 
error message. 
   - Rethrown as an IllegalStateException with a message that includes the 
original exception’s message from the compiler.
   For a invalid groovy script like:
   
   Groovy({def slrpr= new groovy.json.JsonSlurper(); def input = 
slrpr.parseText(opens); def df = new 
SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\"); 
input.collect(df.parse(it.created_at[$date]).getTime())}, opens)
   
   An error message is displayed like: 
   ![Screenshot 2025-04-07 at 6 55 45 
PM](https://github.com/user-attachments/assets/4fe0d192-190e-4162-b72a-ba1c950ac425)
   
   “ERROR [GroovyFunctionEvaluator] [grizzly-http-server-22] Groovy compilation 
error: Groovy({def slrpr= new groovy.json.JsonSlurper(); def input = 
slrpr.parseText(opens); def df = new 
SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss'Z'\"); 
input.collect(df.parse(it.created_at[$date]).getTime())}, opens) 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: 
Script1.groovy: 1: unexpected char: '\' @ line 1, column 109.
      def df = new SimpleDateFormat(\"yyyy-MM-
                                    ^
   
   1 error”


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to