Delete ReduceToPhysicalTransform.

This commit is contained in:
Nikolai Kochetov 2022-02-15 16:49:35 +00:00
parent b2b29b7ee8
commit a7ac6f0b81
2 changed files with 0 additions and 57 deletions

View File

@ -1,35 +0,0 @@
#include <Processors/Transforms/ReduceToPhysicalTransform.h>
#include <Common/PODArray.h>
namespace DB
{
Block ReduceToPhysicalTransform::transformToPhysicalBlock(const Block & header, const ColumnsDescription & columns)
{
Block out = header.cloneWithoutColumns();
for (const auto & column : columns.getEphemeral())
if (out.has(column.name))
out.erase(column.name);
return out;
}
ReduceToPhysicalTransform::ReduceToPhysicalTransform(const Block & input_header, const ColumnsDescription & columns) :
ISimpleTransform(input_header, transformToPhysicalBlock(input_header, columns), false)
{
/// Find non-physical columns in input_header
for (const auto & column : columns.getEphemeral())
if (input_header.has(column.name))
index.push_back(input_header.getPositionByName(column.name));
std::sort(index.begin(), index.end(), std::greater());
}
void ReduceToPhysicalTransform::transform(Chunk & chunk)
{
for (size_t i : index)
chunk.erase(i);
}
}

View File

@ -1,22 +0,0 @@
#pragma once
#include <Processors/ISimpleTransform.h>
#include <Storages/ColumnsDescription.h>
namespace DB
{
/// Remove non-physical columns.
class ReduceToPhysicalTransform : public ISimpleTransform
{
public:
ReduceToPhysicalTransform(const Block & input_header, const ColumnsDescription & columns);
String getName() const override { return "ReduceToPhysicalTransform"; }
static Block transformToPhysicalBlock(const Block & header, const ColumnsDescription & columns);
protected:
void transform(Chunk & chunk) override;
private:
std::vector<size_t> index;
};
}