-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix executing empty sql statement in preactions and postactions #439
Comments
I am working on the fix and will soon raise a PR |
Link to PR: |
@JoshRosen @marmbrus @brkyvz Please take a look |
Having the same issue, your fix would help a lot. |
can we merge this please @JoshRosen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Say for example:
you need to execute preactions/postactions
val preactions = "update table1 set col1=2; update table2 set col2 = 2; "
Looks nothing wrong, correct?
Only when you try to execute it, you will get weird error:
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
This is because of Line 248 and Line 260 in Parameters.scala
def preActions: Array[String] = parameters("preactions").split(";")
def postActions: Array[String] = parameters("postactions").split(";")
the above functions are called in RedshiftWriter.scala LN: 132 and LN: 195
parameters("preactions").split(";")
-- this returns an array of 3 items, with the 3rd item being empty string (only spaces) - see trailing spaces in
val preactions = "update table1 set col1=2; update table2 set col2 = 2; "
and then it tries to execute sql query which is essentially just "spaces"
The fix is to just trim preactions and postactions so that the trailing spaces are not considered as query to be executed
The text was updated successfully, but these errors were encountered: