You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "bersprockets (via GitHub)" <gi...@apache.org> on 2024/02/21 18:25:59 UTC

[PR] [SPARK-47104][SQL] `TakeOrderedAndProjectExec` should initialize the unsafe projection [spark]

bersprockets opened a new pull request, #45199:
URL: https://github.com/apache/spark/pull/45199

   ### What changes were proposed in this pull request?
   
   Change `TakeOrderedAndProjectExec#executeCollect` and `TakeOrderedAndProjectExec#doExecute` to initialize the unsafe projection before using it to produce output rows.
   
   ### Why are the changes needed?
   
   Because the unsafe projection is not initialized, non-deterministic expressions also don't get initialized. This results in errors when the projection contains non-deterministic expressions. For example:
   ```
   create or replace temp view v1(id, name) as values
   (1, "fred"),
   (2, "bob");
   
   cache table v1;
   
   select name, uuid() as _iid from (
     select * from v1 order by name
   )
   limit 20;
   ```
   This query produces the following error:
   ```
   java.lang.NullPointerException: Cannot invoke "org.apache.spark.sql.catalyst.util.RandomUUIDGenerator.getNextUUIDUTF8String()" because "this.randomGen_0" is null
   	at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source)
   	at org.apache.spark.sql.execution.TakeOrderedAndProjectExec.$anonfun$executeCollect$6(limit.scala:297)
   	at scala.collection.ArrayOps$.map$extension(ArrayOps.scala:934)
   	at org.apache.spark.sql.execution.TakeOrderedAndProjectExec.$anonfun$executeCollect$1(limit.scala:297)
   ...
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   New test.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-47104][SQL] `TakeOrderedAndProjectExec` should initialize the unsafe projection [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #45199: [SPARK-47104][SQL] `TakeOrderedAndProjectExec` should initialize the unsafe projection
URL: https://github.com/apache/spark/pull/45199


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-47104][SQL] `TakeOrderedAndProjectExec` should initialize the unsafe projection [spark]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #45199:
URL: https://github.com/apache/spark/pull/45199#issuecomment-1957895774

   Merged to master for Apache Spark 4.0.0.


-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org