chenhao-db commented on PR #47796:
URL: https://github.com/apache/spark/pull/47796#issuecomment-2299989882
In `select
xpath('<a><b>b1</b><b>b2</b><b>b3</b><c>c1</c><c>c2</c></a>','a/b');`, the
Spark results before and after the change are the same: `[null,null,null]`. The
change only marks the return type correctly, but doesn't change the return
value.
However, in `select coalesce(xpath(repeat('<a></a>', id), 'a')[0], '') from
range(1, 2)`, the query would fail with an NPE in generated code before the
change, like:
```
Caused by: java.lang.NullPointerException
at
org.apache.spark.sql.catalyst.expressions.codegen.UnsafeWriter.write(UnsafeWriter.java:110)
at
org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown
Source)
at
org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown
Source)
at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
...
```
But will return an empty string after the change.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]