Skip to content

Conversation

@LiBinfeng-01
Copy link
Contributor

pick: #45233
Issue Number: #44666
Related PR: #40441

Problem Summary:

  • select substring_index('哈哈哈AAA','A', 1); String.split function has second parameter 'limit', which is default zero. When 'limit' is zero, it means it would remove trailing empty strings split of '哈哈哈AAA', which would be '哈哈哈' only. But what we expect is '哈哈哈', '','','' when part function is used by substring index. So we should change splitpart limit to -1 to enable trailing empty character in splitpart list
  • reorganize fold constant of string functions in fe and add more cases

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

…re cases (apache#45233)

Issue Number: apache#44666
Related PR: apache#40441

Problem Summary:
- select substring_index('哈哈哈AAA','A', 1);
String.split function has second parameter 'limit', which is default
zero. When 'limit' is zero, it means it would remove trailing
empty strings split of '哈哈哈AAA', which would be '哈哈哈' only. But what we
expect is '哈哈哈', '','','' when part function is used by substring index.
So we should change splitpart limit to -1 to enable trailing empty
character in splitpart list
- reorganize fold constant of string functions in fe and add more cases
@Thearas
Copy link
Contributor

Thearas commented Jan 7, 2025

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@LiBinfeng-01
Copy link
Contributor Author

run buildall

LiBinfeng-01 and others added 2 commits January 9, 2025 10:59
apache#40820)

example: select append_trailing_char_if_absent('it','a') would return
null in original design, it can not return null when folding constant on
fe any time
…oldConst. (apache#40947)

```
mysql [(none)]>set debug_skip_fold_constant = false;
Query OK, 0 rows affected (0.00 sec)

mysql [(none)]>select length('你');
+---------------+
| length('你')  |
+---------------+
|             1 |
+---------------+
1 row in set (0.01 sec)

mysql [(none)]>set debug_skip_fold_constant = true;
Query OK, 0 rows affected (0.00 sec)

mysql [(none)]>select length('你');
+---------------+
| length('你')  |
+---------------+
|             3 |
+---------------+
```

<!--Describe your changes.-->
@LiBinfeng-01
Copy link
Contributor Author

run buildall

@LiBinfeng-01
Copy link
Contributor Author

run buildall

@morrySnow morrySnow merged commit 912e4ca into apache:branch-2.1 Jan 9, 2025
18 of 19 checks passed
GoGoWen pushed a commit to GoGoWen/incubator-doris that referenced this pull request Sep 26, 2025
…e cases apache#45233 (apache#46523)

pick: apache#45233
Issue Number: apache#44666
Related PR: apache#40441
Problem Summary:
select substring_index('哈哈哈AAA','A', 1); String.split function has
second parameter 'limit', which is default zero. When 'limit' is zero,
it means it would remove trailing empty strings split of '哈哈哈AAA', which
would be '哈哈哈' only. But what we expect is '哈哈哈', '','','' when part
function is used by substring index. So we should change splitpart limit
to -1 to enable trailing empty character in splitpart list
reorganize fold constant of string functions in fe and add more cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants