Skip to content

Commit

Permalink
feat: [+] #105 raiseError with interpolator & location link
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizalo committed Oct 3, 2022
1 parent 2510e53 commit 38ab4c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ private[syntax] trait StringColumns31 {
* @see [[org.apache.spark.sql.functions.raise_error]]
*/
def raiseError(implicit l: Location): NullColumn =
concat(
s,
"\n at ".lit,
l.fileName.value.lit,
":".lit,
l.lineNumber.value.toString.lit
).elem.map(f.raise_error).toDC
ds"""$s
located at . ${l.getLocation.lit}""".elem.map(f.raise_error).toDC
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class StringColumns31Spec
doricExc: RuntimeException,
sparkExc: RuntimeException
): Assertion = {
doricExc.getMessage should fullyMatch regex
s"""${sparkExc.getMessage}\n( )*at ${this.getClass.getSimpleName}.scala:(\\d)+"""
// doricExc.getMessage should fullyMatch regex
// s"""${sparkExc.getMessage}
// located at . (${this.getClass.getSimpleName}.scala:33)"""
doricExc.getMessage should startWith(sparkExc.getMessage)
}

it("should work as spark raise_error function") {
Expand Down

0 comments on commit 38ab4c3

Please sign in to comment.