Skip to content

Commit

Permalink
Revert "Optimize expression LIKE() ESCAPE() for bin collator (pingc…
Browse files Browse the repository at this point in the history
…ap#5489)"

This reverts commit 30fc64c.
  • Loading branch information
solotzg committed Sep 19, 2022
1 parent 2424796 commit 0e129b1
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 637 deletions.
14 changes: 10 additions & 4 deletions dbms/src/Functions/CollationOperatorOptimized.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ __attribute__((flatten, always_inline)) inline void LoopTwoColumns(
{
ColumnString::Offset a_prev_offset = 0;
ColumnString::Offset b_prev_offset = 0;
const auto * a_ptr = reinterpret_cast<const char *>(a_data.data());
const auto * b_ptr = reinterpret_cast<const char *>(b_data.data());

for (size_t i = 0; i < size; ++i)
{
auto a_size = a_offsets[i] - a_prev_offset;
auto b_size = b_offsets[i] - b_prev_offset;

// Remove last zero byte.
func({reinterpret_cast<const char *>(&a_data[a_prev_offset]), a_size - 1},
{reinterpret_cast<const char *>(&b_data[b_prev_offset]), b_size - 1},
i);
func({a_ptr, a_size - 1}, {b_ptr, b_size - 1}, i);

a_ptr += a_size;
b_ptr += b_size;

a_prev_offset = a_offsets[i];
b_prev_offset = b_offsets[i];
Expand All @@ -86,13 +89,16 @@ __attribute__((flatten, always_inline)) inline void LoopOneColumn(
F && func)
{
ColumnString::Offset a_prev_offset = 0;
const auto * a_ptr = reinterpret_cast<const char *>(a_data.data());

for (size_t i = 0; i < size; ++i)
{
auto a_size = a_offsets[i] - a_prev_offset;

// Remove last zero byte.
func({reinterpret_cast<const char *>(&a_data[a_prev_offset]), a_size - 1}, i);
func({a_ptr, a_size - 1}, i);

a_ptr += a_size;
a_prev_offset = a_offsets[i];
}
}
Expand Down
Loading

0 comments on commit 0e129b1

Please sign in to comment.