Skip to content

Commit

Permalink
fix compilation error on arm64 (#9839)
Browse files Browse the repository at this point in the history
close #9838

Signed-off-by: guo-shaoge <[email protected]>
  • Loading branch information
guo-shaoge authored Feb 5, 2025
1 parent 57122fa commit 4abb401
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 77 deletions.
117 changes: 116 additions & 1 deletion dbms/src/Columns/ColumnDecimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,122 @@ const char * ColumnDecimal<T>::deserializeAndInsertFromArena(const char * pos, c
}
}

template <typename T>
void ColumnDecimal<T>::countSerializeByteSizeForCmp(PaddedPODArray<size_t> & byte_size, const TiDB::TiDBCollatorPtr &)
const
{
countSerializeByteSizeImpl<true>(byte_size);
}

template <typename T>
void ColumnDecimal<T>::countSerializeByteSize(PaddedPODArray<size_t> & byte_size) const
{
countSerializeByteSizeImpl<false>(byte_size);
}


template <typename T>
void ColumnDecimal<T>::countSerializeByteSizeForCmpColumnArray(
PaddedPODArray<size_t> & byte_size,
const IColumn::Offsets & array_offsets,
const TiDB::TiDBCollatorPtr &) const
{
countSerializeByteSizeForColumnArrayImpl<true>(byte_size, array_offsets);
}

template <typename T>
void ColumnDecimal<T>::countSerializeByteSizeForColumnArray(
PaddedPODArray<size_t> & byte_size,
const IColumn::Offsets & array_offsets) const
{
countSerializeByteSizeForColumnArrayImpl<false>(byte_size, array_offsets);
}


template <typename T>
void ColumnDecimal<T>::serializeToPosForCmp(
PaddedPODArray<char *> & pos,
size_t start,
size_t length,
bool has_null,
const TiDB::TiDBCollatorPtr &,
String *) const
{
if (has_null)
serializeToPosImpl</*has_null=*/true, /*for_compare=*/true>(pos, start, length);
else
serializeToPosImpl</*has_null=*/false, /*for_compare=*/true>(pos, start, length);
}

template <typename T>
void ColumnDecimal<T>::serializeToPos(PaddedPODArray<char *> & pos, size_t start, size_t length, bool has_null) const
{
if (has_null)
serializeToPosImpl</*has_null=*/true, /*for_compare=*/false>(pos, start, length);
else
serializeToPosImpl</*has_null=*/false, /*for_compare=*/false>(pos, start, length);
}

template <typename T>
void ColumnDecimal<T>::serializeToPosForCmpColumnArray(
PaddedPODArray<char *> & pos,
size_t start,
size_t length,
bool has_null,
const IColumn::Offsets & array_offsets,
const TiDB::TiDBCollatorPtr &,
String *) const
{
if (has_null)
serializeToPosForColumnArrayImpl</*has_null=*/true, /*for_compare=*/true>(pos, start, length, array_offsets);
else
serializeToPosForColumnArrayImpl</*has_null=*/false, /*for_compare=*/true>(pos, start, length, array_offsets);
}

template <typename T>
void ColumnDecimal<T>::serializeToPosForColumnArray(
PaddedPODArray<char *> & pos,
size_t start,
size_t length,
bool has_null,
const IColumn::Offsets & array_offsets) const
{
if (has_null)
serializeToPosForColumnArrayImpl</*has_null=*/true, /*for_compare=*/false>(pos, start, length, array_offsets);
else
serializeToPosForColumnArrayImpl</*has_null=*/false, /*for_compare=*/false>(pos, start, length, array_offsets);
}

template <typename T>
void ColumnDecimal<T>::deserializeForCmpAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer)
{
deserializeAndInsertFromPosImpl<true>(pos, use_nt_align_buffer);
}

template <typename T>
void ColumnDecimal<T>::deserializeAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer)
{
deserializeAndInsertFromPosImpl<false>(pos, use_nt_align_buffer);
}

template <typename T>
void ColumnDecimal<T>::deserializeForCmpAndInsertFromPosColumnArray(
PaddedPODArray<char *> & pos,
const IColumn::Offsets & array_offsets,
bool use_nt_align_buffer)
{
deserializeAndInsertFromPosForColumnArrayImpl<true>(pos, array_offsets, use_nt_align_buffer);
}

template <typename T>
void ColumnDecimal<T>::deserializeAndInsertFromPosForColumnArray(
PaddedPODArray<char *> & pos,
const IColumn::Offsets & array_offsets,
bool use_nt_align_buffer)
{
deserializeAndInsertFromPosForColumnArrayImpl<false>(pos, array_offsets, use_nt_align_buffer);
}

template <typename T>
template <bool for_compare>
void ColumnDecimal<T>::countSerializeByteSizeImpl(PaddedPODArray<size_t> & byte_size) const
Expand All @@ -160,7 +276,6 @@ void ColumnDecimal<T>::countSerializeByteSizeImpl(PaddedPODArray<size_t> & byte_
}
}

// TODO add unit test
template <typename T>
template <bool for_compare>
void ColumnDecimal<T>::countSerializeByteSizeForColumnArrayImpl(
Expand Down
88 changes: 12 additions & 76 deletions dbms/src/Columns/ColumnDecimal.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,49 +173,25 @@ class ColumnDecimal final : public COWPtrHelper<ColumnVectorHelper, ColumnDecima
String &) const override;
const char * deserializeAndInsertFromArena(const char * pos, const TiDB::TiDBCollatorPtr &) override;

void countSerializeByteSizeForCmp(PaddedPODArray<size_t> & byte_size, const TiDB::TiDBCollatorPtr &) const override
{
countSerializeByteSizeImpl<true>(byte_size);
}
void countSerializeByteSize(PaddedPODArray<size_t> & byte_size) const override
{
countSerializeByteSizeImpl<false>(byte_size);
}
void countSerializeByteSizeForCmp(PaddedPODArray<size_t> & byte_size, const TiDB::TiDBCollatorPtr &) const override;
void countSerializeByteSize(PaddedPODArray<size_t> & byte_size) const override;

void countSerializeByteSizeForCmpColumnArray(
PaddedPODArray<size_t> & byte_size,
const IColumn::Offsets & array_offsets,
const TiDB::TiDBCollatorPtr &) const override
{
countSerializeByteSizeForColumnArrayImpl<true>(byte_size, array_offsets);
}
const TiDB::TiDBCollatorPtr &) const override;
void countSerializeByteSizeForColumnArray(
PaddedPODArray<size_t> & byte_size,
const IColumn::Offsets & array_offsets) const override
{
countSerializeByteSizeForColumnArrayImpl<false>(byte_size, array_offsets);
}
const IColumn::Offsets & array_offsets) const override;

void serializeToPosForCmp(
PaddedPODArray<char *> & pos,
size_t start,
size_t length,
bool has_null,
const TiDB::TiDBCollatorPtr &,
String *) const override
{
if (has_null)
serializeToPosImpl</*has_null=*/true, /*for_compare=*/true>(pos, start, length);
else
serializeToPosImpl</*has_null=*/false, /*for_compare=*/true>(pos, start, length);
}
void serializeToPos(PaddedPODArray<char *> & pos, size_t start, size_t length, bool has_null) const override
{
if (has_null)
serializeToPosImpl</*has_null=*/true, /*for_compare=*/false>(pos, start, length);
else
serializeToPosImpl</*has_null=*/false, /*for_compare=*/false>(pos, start, length);
}
String *) const override;
void serializeToPos(PaddedPODArray<char *> & pos, size_t start, size_t length, bool has_null) const override;

void serializeToPosForCmpColumnArray(
PaddedPODArray<char *> & pos,
Expand All @@ -224,65 +200,25 @@ class ColumnDecimal final : public COWPtrHelper<ColumnVectorHelper, ColumnDecima
bool has_null,
const IColumn::Offsets & array_offsets,
const TiDB::TiDBCollatorPtr &,
String *) const override
{
if (has_null)
serializeToPosForColumnArrayImpl</*has_null=*/true, /*for_compare=*/true>(
pos,
start,
length,
array_offsets);
else
serializeToPosForColumnArrayImpl</*has_null=*/false, /*for_compare=*/true>(
pos,
start,
length,
array_offsets);
}
String *) const override;
void serializeToPosForColumnArray(
PaddedPODArray<char *> & pos,
size_t start,
size_t length,
bool has_null,
const IColumn::Offsets & array_offsets) const override
{
if (has_null)
serializeToPosForColumnArrayImpl</*has_null=*/true, /*for_compare=*/false>(
pos,
start,
length,
array_offsets);
else
serializeToPosForColumnArrayImpl</*has_null=*/false, /*for_compare=*/false>(
pos,
start,
length,
array_offsets);
}
const IColumn::Offsets & array_offsets) const override;

void deserializeForCmpAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer) override
{
deserializeAndInsertFromPosImpl<true>(pos, use_nt_align_buffer);
}
void deserializeAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer) override
{
deserializeAndInsertFromPosImpl<false>(pos, use_nt_align_buffer);
}
void deserializeForCmpAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer) override;
void deserializeAndInsertFromPos(PaddedPODArray<char *> & pos, bool use_nt_align_buffer) override;

void deserializeForCmpAndInsertFromPosColumnArray(
PaddedPODArray<char *> & pos,
const IColumn::Offsets & array_offsets,
bool use_nt_align_buffer) override
{
deserializeAndInsertFromPosForColumnArrayImpl<true>(pos, array_offsets, use_nt_align_buffer);
}
bool use_nt_align_buffer) override;
void deserializeAndInsertFromPosForColumnArray(
PaddedPODArray<char *> & pos,
const IColumn::Offsets & array_offsets,
bool use_nt_align_buffer) override
{
deserializeAndInsertFromPosForColumnArrayImpl<false>(pos, array_offsets, use_nt_align_buffer);
}
bool use_nt_align_buffer) override;

void flushNTAlignBuffer() override;

Expand Down

0 comments on commit 4abb401

Please sign in to comment.