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

[PR] added "DEFAULT_CLI_FORMAT_OPTIONS" for cli and sqllotic test [datafusion]

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

   ## 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.
   -->
   
   Closes https://github.com/apache/datafusion/issues/13872.
   
   Discussions on PR: https://github.com/apache/datafusion/pull/14046
   
   ## 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.  
   -->
   
   The null values are printed blank, now they will be printed as "NULL".
   Before: 
   ```
   > select make_array(null);
   +------------------+
   | make_array(NULL) |
   +------------------+
   | []               |
   +------------------+
   
   > select array_repeat(null,0);
   +-----------------------------+
   | array_repeat(NULL,Int64(0)) |
   +-----------------------------+
   | []                          |
   +-----------------------------+
   
   > select array_repeat(null,1);
   +-----------------------------+
   | array_repeat(NULL,Int64(1)) |
   +-----------------------------+
   | []                          |
   +-----------------------------+
   ```
   
   Now: 
   ```
   > select make_array(null);
   +------------------+
   | make_array(NULL) |
   +------------------+
   | [NULL]           |
   +------------------+
   
   > select array_repeat(null,0);
   +-----------------------------+
   | array_repeat(NULL,Int64(0)) |
   +-----------------------------+
   | []                          |
   +-----------------------------+
   
   > select array_repeat(null,1);
   +-----------------------------+
   | array_repeat(NULL,Int64(1)) |
   +-----------------------------+
   | [NULL]                      |
   +-----------------------------+
   ```
   
   ## What changes are included in this PR?
   
   A `DEFAULT_CLI_FORMAT_OPTIONS` is added for proper formatting in cli for the null values
   <!--
   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?
   Yes, Updated the slt test files.
   <!--
   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?
   Yes
   Breaking changes in cli
   <!--
   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] added "DEFAULT_CLI_FORMAT_OPTIONS" for cli and sqllogic test [datafusion]

Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao commented on PR #14052:
URL: https://github.com/apache/datafusion/pull/14052#issuecomment-2585048618

   Thanks @jatin510


-- 
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] added "DEFAULT_CLI_FORMAT_OPTIONS" for cli and sqllogic test [datafusion]

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


##########
datafusion/functions-nested/src/map.rs:
##########
@@ -195,7 +195,7 @@ SELECT MAP('type', 'test');
 
 SELECT MAP(['POST', 'HEAD', 'PATCH'], [41, 33, null]);
 ----
-{POST: 41, HEAD: 33, PATCH: }
+{POST: 41, HEAD: 33, PATCH: NULL}

Review Comment:
   It is more human-readable to me.



##########
datafusion/sqllogictest/src/engines/datafusion_engine/normalize.rs:
##########
@@ -240,7 +240,8 @@ pub fn cell_to_string(col: &ArrayRef, row: usize) -> Result<String> {
                 Ok(cell_to_string(dict.values(), key)?)
             }
             _ => {
-                let f = ArrayFormatter::try_new(col.as_ref(), &DEFAULT_FORMAT_OPTIONS);
+                let f =
+                    ArrayFormatter::try_new(col.as_ref(), &DEFAULT_CLI_FORMAT_OPTIONS);

Review Comment:
   This change makes it consistent with
   https://github.com/apache/datafusion/blob/61afb0d486b4617ddc79cb01e8765fedd3ae247b/datafusion/sqllogictest/src/engines/datafusion_engine/normalize.rs#L198-L201



-- 
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] added "DEFAULT_CLI_FORMAT_OPTIONS" for cli and sqllogic test [datafusion]

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


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