liukun4515 commented on issue #2759:
URL: 
https://github.com/apache/arrow-datafusion/issues/2759#issuecomment-1162708027

   In the datafusion, we can convert NULL value of the NULL type to any other 
NULL value of data type.
   For example: Convert NULL(NULL) to INT32(NULL) or FLOAT(NULL);
   ❯ EXPLAIN select cast(NULL as FLOAT);
   +---------------+------------------------------------------------------+
   | plan_type     | plan                                                 |
   +---------------+------------------------------------------------------+
   | logical_plan  | Projection: Float32(NULL) AS CAST(NULL AS Float32)   |
   |               |   EmptyRelation                                      |
   | physical_plan | ProjectionExec: expr=[NULL as CAST(NULL AS Float32)] |
   |               |   EmptyExec: produce_one_row=true                    |
   |               |                                                      |
   +---------------+------------------------------------------------------+
   2 rows in set. Query took 0.002 seconds.
   ❯ EXPLAIN select cast(NULL as INT);
   +---------------+----------------------------------------------------+
   | plan_type     | plan                                               |
   +---------------+----------------------------------------------------+
   | logical_plan  | Projection: Int32(NULL) AS CAST(NULL AS Int32)     |
   |               |   EmptyRelation                                    |
   | physical_plan | ProjectionExec: expr=[NULL as CAST(NULL AS Int32)] |
   |               |   EmptyExec: produce_one_row=true                  |
   |               |                                                    |
   +---------------+----------------------------------------------------+


-- 
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]

Reply via email to