jonahgao commented on code in PR #10640:
URL: https://github.com/apache/datafusion/pull/10640#discussion_r1613068493


##########
datafusion/substrait/src/logical_plan/producer.rs:
##########
@@ -1686,7 +1691,7 @@ fn to_substrait_bounds(window_frame: &WindowFrame) -> 
Result<(Bound, Bound)> {
     ))
 }
 
-fn to_substrait_literal(value: &ScalarValue) -> Result<Literal> {
+fn to_substrait_literal(value: &ScalarValue, nullable: bool) -> 
Result<Literal> {

Review Comment:
   According to 
[ExprSchemable::nullable()](https://github.com/apache/datafusion/blob/3e4e09a7b086009921588d52be577ada0ed6d6b9/datafusion/expr/src/expr_schema.rs#L267),
 the nullability of a literal depends on its `ScalarValue`,  so I think the 
`nullable` argument for this function could be omitted.
   ```rust
   fn to_substrait_literal(value: &ScalarValue, nullable: bool) -> 
Result<Literal> {
       if value.is_null() {
           return Ok(Literal {
               nullable: true,
               type_variation_reference: DEFAULT_TYPE_REF,
               literal_type: Some(LiteralType::Null(to_substrait_type(
                   &value.data_type(),
                   true,
               )?)),
           });
       }
   ```
   At the same time, we can also remove `try_to_substrait_null`.



-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to