You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "duongcongtoai (via GitHub)" <gi...@apache.org> on 2025/02/01 03:49:14 UTC

[PR] test: add regression test for unnesting dictionary encoded columns [datafusion]

duongcongtoai opened a new pull request, #14395:
URL: https://github.com/apache/datafusion/pull/14395

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Issues https://github.com/apache/datafusion/issues/6057 was fixed long ago, this PR is only to add regression test
   
   
   ## Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   ## What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] test: add regression test for unnesting dictionary encoded columns [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #14395:
URL: https://github.com/apache/datafusion/pull/14395


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] test: add regression test for unnesting dictionary encoded columns [datafusion]

Posted by "duongcongtoai (via GitHub)" <gi...@apache.org>.
duongcongtoai commented on code in PR #14395:
URL: https://github.com/apache/datafusion/pull/14395#discussion_r1938189021


##########
datafusion/core/tests/dataframe/mod.rs:
##########
@@ -3325,6 +3326,74 @@ async fn unnest_columns() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn unnest_dict_encoded_columns() -> Result<()> {

Review Comment:
   looks like this is not a proper place to put this test :thinking: 



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] test: add regression test for unnesting dictionary encoded columns [datafusion]

Posted by "duongcongtoai (via GitHub)" <gi...@apache.org>.
duongcongtoai commented on code in PR #14395:
URL: https://github.com/apache/datafusion/pull/14395#discussion_r1938392097


##########
datafusion/core/tests/dataframe/mod.rs:
##########
@@ -3325,6 +3326,74 @@ async fn unnest_columns() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn unnest_dict_encoded_columns() -> Result<()> {
+    let ctx = SessionContext::new();
+
+    let str1 = lit(ScalarValue::Dictionary(
+        Box::new(DataType::Int32),
+        Box::new(ScalarValue::new_utf8("x")),
+    ));
+    let str2 = lit(ScalarValue::Dictionary(
+        Box::new(DataType::Int32),
+        Box::new(ScalarValue::new_utf8("y")),
+    ));
+
+    let make_array_udf_expr1 = Expr::ScalarFunction(ScalarFunction::new_udf(
+        make_array_udf(),
+        vec![col("column1")],
+    ));

Review Comment:
   thanks, i applied the suggestion



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] test: add regression test for unnesting dictionary encoded columns [datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #14395:
URL: https://github.com/apache/datafusion/pull/14395#discussion_r1938255523


##########
datafusion/core/tests/dataframe/mod.rs:
##########
@@ -3325,6 +3326,74 @@ async fn unnest_columns() -> Result<()> {
     Ok(())
 }
 
+#[tokio::test]
+async fn unnest_dict_encoded_columns() -> Result<()> {
+    let ctx = SessionContext::new();
+
+    let str1 = lit(ScalarValue::Dictionary(
+        Box::new(DataType::Int32),
+        Box::new(ScalarValue::new_utf8("x")),
+    ));
+    let str2 = lit(ScalarValue::Dictionary(
+        Box::new(DataType::Int32),
+        Box::new(ScalarValue::new_utf8("y")),
+    ));
+
+    let make_array_udf_expr1 = Expr::ScalarFunction(ScalarFunction::new_udf(
+        make_array_udf(),
+        vec![col("column1")],
+    ));

Review Comment:
   If we rewrote this test to use the DataFrame API I think it would belong here nicely
   
   For example:
   ```suggestion
       let make_array_udf_expr1 =make_array_udf()
         .call(vec![col("column1")]));
   ```
   
   Then instead of LogicalPlanBuilder, use the methods on DataFrame 🤔 



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org