Skip to content

Commit b835bd3

Browse files
committed
Actually fix in generated code too
1 parent 545c8de commit b835bd3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ case class RegExpExtract(subject: Expression, regexp: Expression, idx: Expressio
372372
${termPattern}.matcher($subject.toString());
373373
if (${matcher}.find()) {
374374
java.util.regex.MatchResult ${matchResult} = ${matcher}.toMatchResult();
375-
${ev.value} = UTF8String.fromString(${matchResult}.group($idx));
375+
if (${matchResult}.group($idx) == null) {
376+
${ev.value} = UTF8String.EMPTY_UTF8;
377+
} else {
378+
${ev.value} = UTF8String.fromString(${matchResult}.group($idx));
379+
}
376380
$setEvNotNull
377381
} else {
378382
${ev.value} = UTF8String.EMPTY_UTF8;

0 commit comments

Comments
 (0)