-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip default columns on indexation (#6899)
- Loading branch information
1 parent
1c15550
commit 5e95651
Showing
36 changed files
with
424 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#include "subset.h" | ||
#include <ydb/library/actors/core/log.h> | ||
|
||
namespace NKikimr::NArrow { | ||
|
||
TSchemaSubset::TSchemaSubset(const std::set<ui32>& fieldsIdx, const ui32 fieldsCount) { | ||
AFL_VERIFY(fieldsIdx.size() <= fieldsCount); | ||
AFL_VERIFY(fieldsIdx.size()); | ||
if (fieldsCount == fieldsIdx.size()) { | ||
return; | ||
} | ||
Exclude = (fieldsCount - fieldsIdx.size()) < fieldsIdx.size(); | ||
if (!Exclude) { | ||
FieldIdx = std::vector<ui32>(fieldsIdx.begin(), fieldsIdx.end()); | ||
} else { | ||
auto it = fieldsIdx.begin(); | ||
for (ui32 i = 0; i < fieldsCount; ++i) { | ||
if (it == fieldsIdx.end() || i < *it) { | ||
FieldIdx.emplace_back(i); | ||
} else if (*it == i) { | ||
++it; | ||
} else { | ||
AFL_VERIFY(false); | ||
} | ||
} | ||
} | ||
} | ||
|
||
NKikimrArrowSchema::TSchemaSubset TSchemaSubset::SerializeToProto() const { | ||
NKikimrArrowSchema::TSchemaSubset result; | ||
result.MutableList()->SetExclude(Exclude); | ||
for (auto&& i : FieldIdx) { | ||
result.MutableList()->AddFieldsIdx(i); | ||
} | ||
return result; | ||
} | ||
|
||
TConclusionStatus TSchemaSubset::DeserializeFromProto(const NKikimrArrowSchema::TSchemaSubset& proto) { | ||
if (!proto.HasList()) { | ||
return TConclusionStatus::Fail("no schema subset data"); | ||
} | ||
Exclude = proto.GetList().GetExclude(); | ||
std::vector<ui32> fieldIdx; | ||
for (auto&& i : proto.GetList().GetFieldsIdx()) { | ||
fieldIdx.emplace_back(i); | ||
} | ||
std::swap(fieldIdx, FieldIdx); | ||
return TConclusionStatus::Success(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
#include <ydb/core/formats/arrow/protos/fields.pb.h> | ||
#include <ydb/library/conclusion/result.h> | ||
#include <ydb/library/actors/core/log.h> | ||
|
||
namespace NKikimr::NArrow { | ||
|
||
class TSchemaSubset { | ||
private: | ||
std::vector<ui32> FieldIdx; | ||
TString FieldBits; | ||
bool Exclude = false; | ||
public: | ||
TSchemaSubset() = default; | ||
TSchemaSubset(const std::set<ui32>& fieldsIdx, const ui32 fieldsCount); | ||
|
||
template <class T> | ||
std::vector<T> Apply(const std::vector<T>& fullSchema) const { | ||
if (FieldIdx.empty()) { | ||
return fullSchema; | ||
} | ||
std::vector<T> fields; | ||
if (!Exclude) { | ||
for (auto&& i : FieldIdx) { | ||
AFL_VERIFY(i < fullSchema.size()); | ||
fields.emplace_back(fullSchema[i]); | ||
} | ||
} else { | ||
auto it = FieldIdx.begin(); | ||
for (ui32 i = 0; i < fullSchema.size(); ++i) { | ||
if (it == FieldIdx.end() || i < *it) { | ||
AFL_VERIFY(i < fullSchema.size()); | ||
fields.emplace_back(fullSchema[i]); | ||
} else if (i == *it) { | ||
++it; | ||
} else { | ||
AFL_VERIFY(false); | ||
} | ||
} | ||
} | ||
return fields; | ||
} | ||
|
||
NKikimrArrowSchema::TSchemaSubset SerializeToProto() const; | ||
[[nodiscard]] TConclusionStatus DeserializeFromProto(const NKikimrArrowSchema::TSchemaSubset& proto); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package NKikimrArrowSchema; | ||
|
||
message TSchemaSubset { | ||
|
||
message TFieldsList { | ||
optional bool Exclude = 1; | ||
repeated uint32 FieldsIdx = 2; | ||
} | ||
|
||
oneof Implementation { | ||
TFieldsList List = 1; | ||
string Bits = 2; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ PROTO_LIBRARY() | |
|
||
SRCS( | ||
ssa.proto | ||
fields.proto | ||
) | ||
|
||
PEERDIR( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.