phillipleblanc commented on code in PR #14783:
URL: https://github.com/apache/datafusion/pull/14783#discussion_r1967078010


##########
datafusion/sql/src/unparser/expr.rs:
##########
@@ -1624,9 +1624,7 @@ impl Unparser<'_> {
             DataType::Union(_, _) => {
                 not_impl_err!("Unsupported DataType: conversion: 
{data_type:?}")
             }
-            DataType::Dictionary(_, _) => {
-                not_impl_err!("Unsupported DataType: conversion: 
{data_type:?}")
-            }
+            DataType::Dictionary(_, val) => self.arrow_dtype_to_ast_dtype(val),

Review Comment:
   Let's add a test for this new type, see this example for supporting the 
Utf8View type:
   
   ```rust
       #[test]
       fn test_utf8_view_to_sql() -> Result<()> {
           let dialect = CustomDialectBuilder::new()
               .with_utf8_cast_dtype(ast::DataType::Char(None))
               .build();
           let unparser = Unparser::new(&dialect);
   
           let ast_dtype = 
unparser.arrow_dtype_to_ast_dtype(&DataType::Utf8View)?;
   
           assert_eq!(ast_dtype, ast::DataType::Char(None));
   
           let expr = cast(col("a"), DataType::Utf8View);
           let ast = unparser.expr_to_sql(&expr)?;
   
           let actual = format!("{}", ast);
           let expected = r#"CAST(a AS CHAR)"#.to_string();
   
           assert_eq!(actual, expected);
   
           let expr = 
col("a").eq(lit(ScalarValue::Utf8View(Some("hello".to_string()))));
           let ast = unparser.expr_to_sql(&expr)?;
   
           let actual = format!("{}", ast);
           let expected = r#"(a = 'hello')"#.to_string();
   
           assert_eq!(actual, expected);
   
           let expr = col("a").is_not_null();
   
           let ast = unparser.expr_to_sql(&expr)?;
           let actual = format!("{}", ast);
           let expected = r#"a IS NOT NULL"#.to_string();
   
           assert_eq!(actual, expected);
   
           let expr = col("a").is_null();
   
           let ast = unparser.expr_to_sql(&expr)?;
           let actual = format!("{}", ast);
           let expected = r#"a IS NULL"#.to_string();
   
           assert_eq!(actual, expected);
   
           Ok(())
       }
   ```



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