Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-10 Thread via GitHub


jayzhan211 commented on PR #14060:
URL: https://github.com/apache/datafusion/pull/14060#issuecomment-2584988703

   Thanks @niebayes 


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



Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-10 Thread via GitHub


jayzhan211 merged PR #14060:
URL: https://github.com/apache/datafusion/pull/14060


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



Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-09 Thread via GitHub


niebayes commented on PR #14060:
URL: https://github.com/apache/datafusion/pull/14060#issuecomment-2581654390

   I need to bump Rust to 1.84 to pass CI


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



Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-09 Thread via GitHub


jayzhan211 commented on code in PR #14060:
URL: https://github.com/apache/datafusion/pull/14060#discussion_r1909635152


##
datafusion/expr/src/type_coercion/functions.rs:
##
@@ -551,6 +551,10 @@ fn get_valid_types(
 // and their default type is double precision
 if logical_data_type == NativeType::Null {
 valid_type = DataType::Float64;
+} else if !logical_data_type.is_numeric() {
+return plan_err!(
+"The signature expected NativeType::Numeric but received 
{logical_data_type}"
+);

Review Comment:
   f64 is chosen since it is the most compatible type of numeric



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



Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-09 Thread via GitHub


niebayes commented on code in PR #14060:
URL: https://github.com/apache/datafusion/pull/14060#discussion_r1909076566


##
datafusion/physical-expr-common/src/physical_expr.rs:
##
@@ -159,9 +159,7 @@ pub trait DynEq {
 
 impl DynEq for T {
 fn dyn_eq(&self, other: &dyn Any) -> bool {
-other
-.downcast_ref::()
-.map_or(false, |other| other == self)
+other.downcast_ref::() == Some(self)

Review Comment:
   fix clippy



##
datafusion/physical-expr-common/src/sort_expr.rs:
##
@@ -291,9 +291,9 @@ impl PhysicalSortRequirement {
 /// Returns whether this requirement is equal or more specific than 
`other`.
 pub fn compatible(&self, other: &PhysicalSortRequirement) -> bool {
 self.expr.eq(&other.expr)
-&& other.options.map_or(true, |other_opts| {
-self.options.map_or(false, |opts| opts == other_opts)
-})
+&& other
+.options
+.map_or(true, |other_opts| self.options == Some(other_opts))

Review Comment:
   fix clippy



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



Re: [PR] fix: make get_valid_types handle TypeSignature::Numeric correctly [datafusion]

2025-01-09 Thread via GitHub


niebayes commented on code in PR #14060:
URL: https://github.com/apache/datafusion/pull/14060#discussion_r1909055517


##
datafusion/expr/src/type_coercion/functions.rs:
##
@@ -551,6 +551,10 @@ fn get_valid_types(
 // and their default type is double precision
 if logical_data_type == NativeType::Null {
 valid_type = DataType::Float64;
+} else if !logical_data_type.is_numeric() {
+return plan_err!(
+"The signature expected NativeType::Numeric but received 
{logical_data_type}"
+);

Review Comment:
   I'm not entirely clear on the rationale for falling back to Float64 when the 
argument is of type Null. 
   However, I choose to keep this logic and make it a short-circuit before the 
numeric check.



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