martin-g commented on code in PR #18767:
URL: https://github.com/apache/datafusion/pull/18767#discussion_r2535403721


##########
datafusion/expr/src/expr_rewriter/order_by.rs:
##########
@@ -363,4 +363,59 @@ mod test {
         let nulls_first = true;
         expr.sort(asc, nulls_first)
     }
+
+    #[test]
+    fn qualify_column_handles_dotted_and_simple_names() {
+        let qualified =
+            Column::new(Some(TableReference::Bare { table: "t".into() }), 
"c1");
+        assert_eq!(qualify_column(qualified.clone()), qualified);
+
+        let simple = Column::new_unqualified("alias_without_dot");
+        assert_eq!(qualify_column(simple.clone()), simple);
+
+        let dotted = Column::new_unqualified("min(t.c2)");
+        let parsed = qualify_column(dotted);
+        assert_eq!(
+            parsed.relation,
+            Some(TableReference::Bare {
+                table: "min(t".into()

Review Comment:
   Is `min(` expected here ?!
   I'd expect just `t`



##########
datafusion/expr/src/expr_rewriter/order_by.rs:
##########
@@ -363,4 +363,59 @@ mod test {
         let nulls_first = true;
         expr.sort(asc, nulls_first)
     }
+
+    #[test]
+    fn qualify_column_handles_dotted_and_simple_names() {
+        let qualified =
+            Column::new(Some(TableReference::Bare { table: "t".into() }), 
"c1");
+        assert_eq!(qualify_column(qualified.clone()), qualified);
+
+        let simple = Column::new_unqualified("alias_without_dot");
+        assert_eq!(qualify_column(simple.clone()), simple);
+
+        let dotted = Column::new_unqualified("min(t.c2)");
+        let parsed = qualify_column(dotted);
+        assert_eq!(
+            parsed.relation,
+            Some(TableReference::Bare {
+                table: "min(t".into()
+            })
+        );
+        assert_eq!(parsed.name, "c2)");

Review Comment:
   And here I'd expect just `c2` without the trailing `)`



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

Reply via email to