Re: [PR] Chore: implement datetime funcs as ScalarUDFImpl [datafusion-comet]

2025-06-17 Thread via GitHub


mbutrovich merged PR #1874:
URL: https://github.com/apache/datafusion-comet/pull/1874


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



Re: [PR] Chore: implement datetime funcs as ScalarUDFImpl [datafusion-comet]

2025-06-17 Thread via GitHub


trompa commented on code in PR #1874:
URL: https://github.com/apache/datafusion-comet/pull/1874#discussion_r2152871276


##
native/core/src/execution/planner.rs:
##
@@ -460,22 +459,40 @@ impl PhysicalPlanner {
 )))
 }
 ExprStruct::Hour(expr) => {
-let child = self.create_expr(expr.child.as_ref().unwrap(), 
input_schema)?;
+let child =
+self.create_expr(expr.child.as_ref().unwrap(), 
Arc::clone(&input_schema))?;
 let timezone = expr.timezone.clone();
+let args = vec![child];
+let comet_hour = 
Arc::new(ScalarUDF::new_from_impl(SparkHour::new(timezone)));
+let field_ref = Arc::new(Field::new("hour", DataType::Int32, 
true));
+let expr: ScalarFunctionExpr =
+ScalarFunctionExpr::new("hour", comet_hour, args, 
field_ref);
 
-Ok(Arc::new(HourExpr::new(child, timezone)))
+Ok(Arc::new(expr))
 }
 ExprStruct::Minute(expr) => {
-let child = self.create_expr(expr.child.as_ref().unwrap(), 
input_schema)?;
+let child =
+self.create_expr(expr.child.as_ref().unwrap(), 
Arc::clone(&input_schema))?;
 let timezone = expr.timezone.clone();
+let args = vec![child];
+let comet_minute = 
Arc::new(ScalarUDF::new_from_impl(SparkMinute::new(timezone)));
+let field_ref = Arc::new(Field::new("hour", DataType::Int32, 
true));

Review Comment:
   ofc not, copy paste error, fixing!



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



Re: [PR] Chore: implement datetime funcs as ScalarUDFImpl [datafusion-comet]

2025-06-17 Thread via GitHub


mbutrovich commented on code in PR #1874:
URL: https://github.com/apache/datafusion-comet/pull/1874#discussion_r2152838275


##
native/core/src/execution/planner.rs:
##
@@ -460,22 +459,40 @@ impl PhysicalPlanner {
 )))
 }
 ExprStruct::Hour(expr) => {
-let child = self.create_expr(expr.child.as_ref().unwrap(), 
input_schema)?;
+let child =
+self.create_expr(expr.child.as_ref().unwrap(), 
Arc::clone(&input_schema))?;
 let timezone = expr.timezone.clone();
+let args = vec![child];
+let comet_hour = 
Arc::new(ScalarUDF::new_from_impl(SparkHour::new(timezone)));
+let field_ref = Arc::new(Field::new("hour", DataType::Int32, 
true));
+let expr: ScalarFunctionExpr =
+ScalarFunctionExpr::new("hour", comet_hour, args, 
field_ref);
 
-Ok(Arc::new(HourExpr::new(child, timezone)))
+Ok(Arc::new(expr))
 }
 ExprStruct::Minute(expr) => {
-let child = self.create_expr(expr.child.as_ref().unwrap(), 
input_schema)?;
+let child =
+self.create_expr(expr.child.as_ref().unwrap(), 
Arc::clone(&input_schema))?;
 let timezone = expr.timezone.clone();
+let args = vec![child];
+let comet_minute = 
Arc::new(ScalarUDF::new_from_impl(SparkMinute::new(timezone)));
+let field_ref = Arc::new(Field::new("hour", DataType::Int32, 
true));

Review Comment:
   Are these references to "hour" in `ExprStruct::Minute` and 
`ExprStruct::Second` correct?



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



Re: [PR] Chore: implement datetime funcs as ScalarUDFImpl [datafusion-comet]

2025-06-17 Thread via GitHub


trompa commented on PR #1874:
URL: 
https://github.com/apache/datafusion-comet/pull/1874#issuecomment-2979529062

   @mbutrovich 
   
   test checking fold on JVM added, rebased from main.
   
   I think it is ready for a review


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



Re: [PR] Chore: implement datetime funcs as ScalarUDFImpl [datafusion-comet]

2025-06-15 Thread via GitHub


trompa commented on PR #1874:
URL: 
https://github.com/apache/datafusion-comet/pull/1874#issuecomment-2973588238

   code is now using a macro to generate the 3 hour, minute and second 
functions.
   new spark test to check literals are folded on jvm side


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