Skip to content

Commit

Permalink
*: some streams do not need to inherit IProfilingBlockInputStream (#8965
Browse files Browse the repository at this point in the history
)

ref #6233
  • Loading branch information
Lloyd-Pottiger authored Apr 19, 2024
1 parent 9f6f61a commit 536390a
Show file tree
Hide file tree
Showing 30 changed files with 22 additions and 5,079 deletions.
4 changes: 0 additions & 4 deletions dbms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,8 @@ target_include_directories(dbms PUBLIC "${TIFLASH_PROXY_INCLUDE_DIR}")
if (CMAKE_BUILD_TYPE_UC STREQUAL "RELEASE" OR CMAKE_BUILD_TYPE_UC STREQUAL "RELWITHDEBINFO" OR CMAKE_BUILD_TYPE_UC STREQUAL "MINSIZEREL")
# Won't generate debug info for files with heavy template instantiation to achieve faster linking and lower size.
set_source_files_properties(
src/Dictionaries/FlatDictionary.cpp
src/Dictionaries/HashedDictionary.cpp
src/Dictionaries/CacheDictionary.cpp
src/Dictionaries/TrieDictionary.cpp
src/Dictionaries/RangeHashedDictionary.cpp
src/Dictionaries/ComplexKeyHashedDictionary.cpp
src/Dictionaries/ComplexKeyCacheDictionary.cpp
src/Dictionaries/ComplexKeyCacheDictionary_generate1.cpp
src/Dictionaries/ComplexKeyCacheDictionary_generate2.cpp
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/DataStreams/AddExtraTableIDColumnInputStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AddExtraTableIDColumnInputStream::AddExtraTableIDColumnInputStream(
children.push_back(input);
}

Block AddExtraTableIDColumnInputStream::readImpl()
Block AddExtraTableIDColumnInputStream::read()
{
Block res = children.back()->read();
if (!res)
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/DataStreams/AddExtraTableIDColumnInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma once

#include <DataStreams/AddExtraTableIDColumnTransformAction.h>
#include <DataStreams/IProfilingBlockInputStream.h>
#include <DataStreams/IBlockInputStream.h>
#include <Storages/KVStore/Types.h>

namespace DB
Expand All @@ -24,7 +24,7 @@ namespace DB
/**
* Adds an extra TableID column to the block.
*/
class AddExtraTableIDColumnInputStream : public IProfilingBlockInputStream
class AddExtraTableIDColumnInputStream : public IBlockInputStream
{
static constexpr auto NAME = "AddExtraTableIDColumn";

Expand All @@ -36,7 +36,7 @@ class AddExtraTableIDColumnInputStream : public IProfilingBlockInputStream
Block getHeader() const override { return action.getHeader(); }

protected:
Block readImpl() override;
Block read() override;

private:
const TableID physical_table_id;
Expand Down
64 changes: 0 additions & 64 deletions dbms/src/DataStreams/AddingConstColumnBlockInputStream.h

This file was deleted.

4 changes: 2 additions & 2 deletions dbms/src/DataStreams/IProfilingBlockInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class IProfilingBlockInputStream : public IBlockInputStream
public:
IProfilingBlockInputStream();

Block read() override final;
Block read() final;

Block read(FilterPtr & res_filter, bool return_filter) override;

Expand Down Expand Up @@ -242,7 +242,7 @@ class IProfilingBlockInputStream : public IBlockInputStream
std::shared_lock lock(children_mutex);

for (auto & child : children)
if (IProfilingBlockInputStream * p_child = dynamic_cast<IProfilingBlockInputStream *>(child.get()))
if (auto * p_child = dynamic_cast<IProfilingBlockInputStream *>(child.get()))
if (f(*p_child))
return;
}
Expand Down
7 changes: 0 additions & 7 deletions dbms/src/Dictionaries/CacheDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <Common/randomSeed.h>
#include <Common/typeid_cast.h>
#include <Dictionaries/CacheDictionary.h>
#include <Dictionaries/DictionaryBlockInputStream.h>

#include <ext/map.h>
#include <ext/range.h>
Expand Down Expand Up @@ -996,11 +995,5 @@ PaddedPODArray<CacheDictionary::Key> CacheDictionary::getCachedIds() const
return array;
}

BlockInputStreamPtr CacheDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size) const
{
using BlockInputStreamType = DictionaryBlockInputStream<CacheDictionary, Key>;
return std::make_shared<BlockInputStreamType>(shared_from_this(), max_block_size, getCachedIds(), column_names);
}


} // namespace DB
2 changes: 0 additions & 2 deletions dbms/src/Dictionaries/CacheDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,6 @@ class CacheDictionary final : public IDictionary

void has(const PaddedPODArray<Key> & ids, PaddedPODArray<UInt8> & out) const override;

BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override;

private:
template <typename Value>
using ContainerType = Value[];
Expand Down
15 changes: 0 additions & 15 deletions dbms/src/Dictionaries/ComplexKeyCacheDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <Common/Stopwatch.h>
#include <Common/randomSeed.h>
#include <Dictionaries/ComplexKeyCacheDictionary.h>
#include <Dictionaries/DictionaryBlockInputStream.h>

#include <ext/map.h>
#include <ext/range.h>
Expand Down Expand Up @@ -391,18 +390,4 @@ bool ComplexKeyCacheDictionary::isEmptyCell(const UInt64 idx) const
|| cells[idx].data == ext::safe_bit_cast<CellMetadata::time_point_urep_t>(CellMetadata::time_point_t())));
}

BlockInputStreamPtr ComplexKeyCacheDictionary::getBlockInputStream(const Names & column_names, size_t max_block_size)
const
{
std::vector<StringRef> keys;
{
for (auto idx : ext::range(0, cells.size()))
if (!isEmptyCell(idx) && !cells[idx].isDefault())
keys.push_back(cells[idx].key);
}

using BlockInputStreamType = DictionaryBlockInputStream<ComplexKeyCacheDictionary, UInt64>;
return std::make_shared<BlockInputStreamType>(shared_from_this(), max_block_size, keys, column_names);
}

} // namespace DB
2 changes: 0 additions & 2 deletions dbms/src/Dictionaries/ComplexKeyCacheDictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ class ComplexKeyCacheDictionary final : public IDictionaryBase

void has(const Columns & key_columns, const DataTypes & key_types, PaddedPODArray<UInt8> & out) const;

BlockInputStreamPtr getBlockInputStream(const Names & column_names, size_t max_block_size) const override;

private:
template <typename Value>
using MapType = HashMapWithSavedHash<StringRef, Value, StringRefHash>;
Expand Down
Loading

0 comments on commit 536390a

Please sign in to comment.