You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/04/28 12:52:11 UTC

[GitHub] [arrow-datafusion] ovr opened a new pull request, #2366: feat: Support casting to array of primity type

ovr opened a new pull request, #2366:
URL: https://github.com/apache/arrow-datafusion/pull/2366

   # Which issue does this PR close?
   
   This PR allows the use of cast with array subtype.
   
   Closes #.
   
   # Are there any user-facing changes?
   
   No
   
   Thanks


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] alamb merged pull request #2366: feat: Support casting to arrays to primitive type

Posted by GitBox <gi...@apache.org>.
alamb merged PR #2366:
URL: https://github.com/apache/arrow-datafusion/pull/2366


-- 
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-unsubscribe@arrow.apache.org

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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #2366: feat: Support casting to arrays to primitive type

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #2366:
URL: https://github.com/apache/arrow-datafusion/pull/2366#discussion_r861300917


##########
datafusion/core/src/sql/planner.rs:
##########
@@ -2395,7 +2395,10 @@ pub fn convert_data_type(sql_type: &SQLDataType) -> Result<DataType> {
         SQLDataType::Float(_) => Ok(DataType::Float32),
         SQLDataType::Real => Ok(DataType::Float32),
         SQLDataType::Double => Ok(DataType::Float64),
-        SQLDataType::Char(_) | SQLDataType::Varchar(_) => Ok(DataType::Utf8),
+        SQLDataType::Char(_)
+        | SQLDataType::Varchar(_)
+        | SQLDataType::Text

Review Comment:
   This also adds support for the `TEXT` sql type, right? (not a problem, I am just validating that this was intended)



##########
datafusion/core/tests/sql/expr.rs:
##########
@@ -796,6 +796,11 @@ async fn test_regex_expressions() -> Result<()> {
 
 #[tokio::test]
 async fn test_cast_expressions() -> Result<()> {
+    test_expression!("CAST([1,2,3,4] AS INT[])", "[1, 2, 3, 4]");
+    test_expression!(
+        "CAST([1,2,3,4] AS NUMERIC(10,4)[])",

Review Comment:
   👍 
   
   I ran this test without the code change and it failed like
   
   ```
   ---- sql::expr::test_cast_expressions stdout ----
   thread 'sql::expr::test_cast_expressions' panicked at 'Creating logical plan for 'SELECT CAST([1,2,3,4] AS INT[])': NotImplemented("Unsupported SQL type Array(Int(None))")', datafusion/core/tests/sql/mod.rs:538:45
   
   ```
   
   In case anyone was curious



-- 
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-unsubscribe@arrow.apache.org

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