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

[PR] Always use `StringViewArray` as output of `substr` [datafusion]

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

   ## 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 #12338
   
   ## Rationale for this change
   
   Generate `StringViewArray` whatever input type is for efficiency.
   <!--
    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?
   
   1. Behavior of `substr`, return type is always `Utf8View`.
   2. Unittest updated.
   3. Some changes in `datafusion/sqllogictest/test_files/tpch/plans/q22.slt.part`.
   <!--
   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.
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   4. 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?
   
   I'm not sure, the return type of substr is fixed to `Utf8View` now.
   
   <!--
   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] Always use `StringViewArray` as output of `substr` [datafusion]

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


-- 
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] Always use `StringViewArray` as output of `substr` [datafusion]

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

   Thank you, it looks good to me.
   Could you resolve the conflict?


-- 
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] Always use `StringViewArray` as output of `substr` [datafusion]

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

   > My benchmark results show no change in Q22 (but also clearly the data is quite noisy ๐Ÿค” )
   > 
   > ```
   > --------------------
   > Benchmark tpch_sf1.json
   > --------------------
   > โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
   > โ”ƒ Query        โ”ƒ main_base โ”ƒ substr-always-output-utf8view โ”ƒ        Change โ”ƒ
   > โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
   > โ”‚ QQuery 1     โ”‚  220.66ms โ”‚                      217.19ms โ”‚     no change โ”‚
   > โ”‚ QQuery 2     โ”‚  120.04ms โ”‚                      118.99ms โ”‚     no change โ”‚
   > โ”‚ QQuery 3     โ”‚  117.00ms โ”‚                      133.73ms โ”‚  1.14x slower โ”‚
   > โ”‚ QQuery 4     โ”‚   82.79ms โ”‚                       84.31ms โ”‚     no change โ”‚
   > โ”‚ QQuery 5     โ”‚  161.05ms โ”‚                      158.10ms โ”‚     no change โ”‚
   > โ”‚ QQuery 6     โ”‚   43.91ms โ”‚                       61.73ms โ”‚  1.41x slower โ”‚
   > โ”‚ QQuery 7     โ”‚  196.49ms โ”‚                      208.38ms โ”‚  1.06x slower โ”‚
   > โ”‚ QQuery 8     โ”‚  161.86ms โ”‚                      168.99ms โ”‚     no change โ”‚
   > โ”‚ QQuery 9     โ”‚  239.92ms โ”‚                      240.70ms โ”‚     no change โ”‚
   > โ”‚ QQuery 10    โ”‚  207.67ms โ”‚                      203.80ms โ”‚     no change โ”‚
   > โ”‚ QQuery 11    โ”‚   96.42ms โ”‚                       94.76ms โ”‚     no change โ”‚
   > โ”‚ QQuery 12    โ”‚  104.79ms โ”‚                      119.54ms โ”‚  1.14x slower โ”‚
   > โ”‚ QQuery 13    โ”‚  203.66ms โ”‚                      208.01ms โ”‚     no change โ”‚
   > โ”‚ QQuery 14    โ”‚   71.92ms โ”‚                       70.81ms โ”‚     no change โ”‚
   > โ”‚ QQuery 15    โ”‚  118.13ms โ”‚                      130.72ms โ”‚  1.11x slower โ”‚
   > โ”‚ QQuery 16    โ”‚   68.90ms โ”‚                       72.23ms โ”‚     no change โ”‚
   > โ”‚ QQuery 17    โ”‚  216.46ms โ”‚                      213.50ms โ”‚     no change โ”‚
   > โ”‚ QQuery 18    โ”‚  319.42ms โ”‚                      322.68ms โ”‚     no change โ”‚
   > โ”‚ QQuery 19    โ”‚  116.85ms โ”‚                      115.95ms โ”‚     no change โ”‚
   > โ”‚ QQuery 20    โ”‚  135.26ms โ”‚                      123.83ms โ”‚ +1.09x faster โ”‚
   > โ”‚ QQuery 21    โ”‚  279.46ms โ”‚                      275.56ms โ”‚     no change โ”‚
   > โ”‚ QQuery 22    โ”‚   68.17ms โ”‚                       67.74ms โ”‚     no change โ”‚
   > โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
   > ```
   
   I believe this is expected to have no change:
   We already have `StringView -> substr() -> StringView`
   This PR just changed `StringArray -> substr() -> StringArray` to `StringArray -> substr() -> StringView`
   
   The benchmark runs on Parquet, which read to StringView by default.
   The TPCH test result changes due to this PR because it runs on CSV (.tbl). Allowing the CSV scanner to produce StringView seems like an optimization we could do


-- 
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] Always use `StringViewArray` as output of `substr` [datafusion]

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

   My benchmark results show no change in Q22 (but also clearly the data is quite noisy ๐Ÿค” )
   
   ```
   --------------------
   Benchmark tpch_sf1.json
   --------------------
   โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
   โ”ƒ Query        โ”ƒ main_base โ”ƒ substr-always-output-utf8view โ”ƒ        Change โ”ƒ
   โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
   โ”‚ QQuery 1     โ”‚  220.66ms โ”‚                      217.19ms โ”‚     no change โ”‚
   โ”‚ QQuery 2     โ”‚  120.04ms โ”‚                      118.99ms โ”‚     no change โ”‚
   โ”‚ QQuery 3     โ”‚  117.00ms โ”‚                      133.73ms โ”‚  1.14x slower โ”‚
   โ”‚ QQuery 4     โ”‚   82.79ms โ”‚                       84.31ms โ”‚     no change โ”‚
   โ”‚ QQuery 5     โ”‚  161.05ms โ”‚                      158.10ms โ”‚     no change โ”‚
   โ”‚ QQuery 6     โ”‚   43.91ms โ”‚                       61.73ms โ”‚  1.41x slower โ”‚
   โ”‚ QQuery 7     โ”‚  196.49ms โ”‚                      208.38ms โ”‚  1.06x slower โ”‚
   โ”‚ QQuery 8     โ”‚  161.86ms โ”‚                      168.99ms โ”‚     no change โ”‚
   โ”‚ QQuery 9     โ”‚  239.92ms โ”‚                      240.70ms โ”‚     no change โ”‚
   โ”‚ QQuery 10    โ”‚  207.67ms โ”‚                      203.80ms โ”‚     no change โ”‚
   โ”‚ QQuery 11    โ”‚   96.42ms โ”‚                       94.76ms โ”‚     no change โ”‚
   โ”‚ QQuery 12    โ”‚  104.79ms โ”‚                      119.54ms โ”‚  1.14x slower โ”‚
   โ”‚ QQuery 13    โ”‚  203.66ms โ”‚                      208.01ms โ”‚     no change โ”‚
   โ”‚ QQuery 14    โ”‚   71.92ms โ”‚                       70.81ms โ”‚     no change โ”‚
   โ”‚ QQuery 15    โ”‚  118.13ms โ”‚                      130.72ms โ”‚  1.11x slower โ”‚
   โ”‚ QQuery 16    โ”‚   68.90ms โ”‚                       72.23ms โ”‚     no change โ”‚
   โ”‚ QQuery 17    โ”‚  216.46ms โ”‚                      213.50ms โ”‚     no change โ”‚
   โ”‚ QQuery 18    โ”‚  319.42ms โ”‚                      322.68ms โ”‚     no change โ”‚
   โ”‚ QQuery 19    โ”‚  116.85ms โ”‚                      115.95ms โ”‚     no change โ”‚
   โ”‚ QQuery 20    โ”‚  135.26ms โ”‚                      123.83ms โ”‚ +1.09x faster โ”‚
   โ”‚ QQuery 21    โ”‚  279.46ms โ”‚                      275.56ms โ”‚     no change โ”‚
   โ”‚ QQuery 22    โ”‚   68.17ms โ”‚                       67.74ms โ”‚     no change โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
   ```


-- 
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] Always use `StringViewArray` as output of `substr` [datafusion]

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

   > Could you resolve the conflict?
   
   Sure. Done.


-- 
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] Always use `StringViewArray` as output of `substr` [datafusion]

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

   Thank you @Kev1n8 and @2010YOUY01  -- I am running some benchmarks on this PR to see if it makes any difference


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