Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add enum StrSlice under enum Evaluated #999

Merged
merged 75 commits into from
Feb 5, 2023

Conversation

zmrdltl
Copy link
Collaborator

@zmrdltl zmrdltl commented Nov 12, 2022

Description

after #966
If a function that handles a string is chained and executed on the query builder, the string is copied every time by the Clone trait. This overhead is solved by always having a sliced ​​enum with a value.

Implementation plan

#[derive(Clone)]
pub enum Evaluated<'a> {
    Literal(Literal<'a>),
    StrSlice { source: String, range: Range<usize> },
    Value(Value),
}

If a variant called source holds the source of the string, and the string function is called continuously after that, the range is updated every time.

Tasks

  • add enum StrSlice

modify string function structure for StrSlice

    • Substr
    • trim
    • ltrim
    • rtrim
  • tests

@zmrdltl zmrdltl changed the title Add enum StrSlice under enum Evaluated Add enum StrSlice under enum Evaluated Nov 12, 2022
core/src/data/key.rs Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Nov 12, 2022

Pull Request Test Coverage Report for Build 4096482561

  • 827 of 827 (100.0%) changed or added relevant lines in 18 files are covered.
  • 64 unchanged lines in 7 files lost coverage.
  • Overall coverage decreased (-0.05%) to 98.513%

Files with Coverage Reduction New Missed Lines %
core/src/ast/mod.rs 1 99.8%
storages/sled-storage/src/index_mut.rs 1 98.66%
core/src/translate/mod.rs 4 95.63%
core/src/executor/alter/table.rs 6 94.92%
storages/sled-storage/src/alter_table.rs 14 96.13%
core/src/executor/execute.rs 19 91.77%
test-suite/src/tester/mod.rs 19 87.33%
Totals Coverage Status
Change from base Build 4040662072: -0.05%
Covered Lines: 38951
Relevant Lines: 39539

💛 - Coveralls

@zmrdltl zmrdltl requested a review from ever0de November 19, 2022 12:13
@panarch panarch added the improvement Improvements for existing features label Nov 20, 2022
@zmrdltl zmrdltl marked this pull request as draft November 26, 2022 13:10
@zmrdltl zmrdltl marked this pull request as ready for review December 15, 2022 14:13
@zmrdltl zmrdltl marked this pull request as ready for review January 24, 2023 06:27
Copy link
Collaborator Author

@zmrdltl zmrdltl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to write part 2 test.

core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Show resolved Hide resolved
core/src/data/value/string.rs Outdated Show resolved Hide resolved
core/src/data/value/string.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
core/src/executor/evaluate/evaluated.rs Outdated Show resolved Hide resolved
Copy link
Member

@panarch panarch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!! New big improvement comes into the project.
Thanks a lot 👍 👍 👍

@panarch panarch merged commit 55e214c into gluesql:main Feb 5, 2023
@zmrdltl zmrdltl deleted the feature-evaluated branch February 6, 2023 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvements for existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants