-
Notifications
You must be signed in to change notification settings - Fork 694
customization fetching by columns #14927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ivanmorozov333
merged 41 commits into
ydb-platform:main
from
ivanmorozov333:partial_column_fetching
Feb 26, 2025
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
28405e7
customization fetching by columns
ivanmorozov333 5740933
fix
ivanmorozov333 9a51781
fetch kernels control
ivanmorozov333 58a5ecd
fixes
ivanmorozov333 68b18f9
fixes
ivanmorozov333 0409023
fixes
ivanmorozov333 0a9cd06
fixes
ivanmorozov333 3e97fa6
correction
ivanmorozov333 c225f5c
restore
ivanmorozov333 938b21f
fix
ivanmorozov333 3a2c6a5
tests and fixes
ivanmorozov333 af3e61a
corrections
ivanmorozov333 e882530
clean logging
ivanmorozov333 ea7d6de
corrections
ivanmorozov333 8ea3ce6
fixes
ivanmorozov333 c68f70b
fix test
ivanmorozov333 69c8af5
fixes
ivanmorozov333 6c5202d
unify columns separation logic
ivanmorozov333 864834d
fix
ivanmorozov333 dd85f9b
fix
ivanmorozov333 9b2830b
corrections
ivanmorozov333 7b9bf2e
fixes
ivanmorozov333 4365873
fix
ivanmorozov333 44ebfe4
fix detector
ivanmorozov333 8526730
test and fix
ivanmorozov333 19ed2f9
add test. fix it.
ivanmorozov333 0efd572
remove danger default value
ivanmorozov333 defe904
fixes
ivanmorozov333 38a5985
fix
ivanmorozov333 b27efd9
speed up
ivanmorozov333 fecda94
speed up filtering (dont apply filter to self-filter columns)
ivanmorozov333 b2abc52
fix
ivanmorozov333 2c76642
fix
ivanmorozov333 a1d4170
add test json exists
ivanmorozov333 d84d302
add counters and remove deprecated fake objects
ivanmorozov333 f3d08d4
reduce logging
ivanmorozov333 b34e5f7
fix tests
ivanmorozov333 6905872
add test. fix
ivanmorozov333 f98b292
fix
ivanmorozov333 1966ab3
tests. fixes
ivanmorozov333 df857f9
test and fixes
ivanmorozov333 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
102 changes: 102 additions & 0 deletions
102
ydb/core/formats/arrow/accessor/composite/ut/ut_composite.cpp
This file contains hidden or 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,102 @@ | ||
#include <ydb/core/formats/arrow/accessor/composite/accessor.h> | ||
#include <ydb/core/formats/arrow/accessor/plain/accessor.h> | ||
#include <ydb/core/formats/arrow/arrow_filter.h> | ||
|
||
#include <library/cpp/testing/unittest/registar.h> | ||
|
||
#include <regex> | ||
|
||
Y_UNIT_TEST_SUITE(CompositeArrayAccessor) { | ||
using namespace NKikimr::NArrow::NAccessor; | ||
using namespace NKikimr::NArrow; | ||
|
||
std::string PrepareToCompare(const std::string& str) { | ||
return std::regex_replace(str, std::regex(" |\\n"), ""); | ||
} | ||
|
||
static std::shared_ptr<IChunkedArray> BuildCompositeArray() { | ||
TCompositeChunkedArray::TBuilder builder(arrow::utf8()); | ||
{ | ||
TTrivialArray::TPlainBuilder arrBuilder; | ||
arrBuilder.AddRecord(1, "a1"); | ||
arrBuilder.AddRecord(3, "a3"); | ||
arrBuilder.AddRecord(7, "a7"); | ||
builder.AddChunk(arrBuilder.Finish(10)); | ||
} | ||
{ | ||
TTrivialArray::TPlainBuilder arrBuilder; | ||
arrBuilder.AddRecord(1, "b1"); | ||
arrBuilder.AddRecord(2, "b2"); | ||
arrBuilder.AddRecord(3, "b3"); | ||
builder.AddChunk(arrBuilder.Finish(5)); | ||
} | ||
{ | ||
TTrivialArray::TPlainBuilder arrBuilder; | ||
arrBuilder.AddRecord(0, "c0"); | ||
arrBuilder.AddRecord(2, "c2"); | ||
arrBuilder.AddRecord(3, "c3"); | ||
builder.AddChunk(arrBuilder.Finish(4)); | ||
} | ||
return builder.Finish(); | ||
} | ||
|
||
Y_UNIT_TEST(SlicesSimple) { | ||
auto arr = BuildCompositeArray(); | ||
Cerr << PrepareToCompare(arr->GetChunkedArray()->ToString()) << Endl; | ||
{ | ||
auto slice = arr->ISlice(0, 10); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([[null,"a1",null,"a3",null,null,null,"a7",null,null]])")("string", arrString); | ||
} | ||
{ | ||
auto slice = arr->ISlice(3, 8); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([["a3",null,null,null,"a7",null,null],[null]])")("string", arrString); | ||
} | ||
{ | ||
auto slice = arr->ISlice(3, 16); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([["a3",null,null,null,"a7",null,null],[null,"b1","b2","b3",null],["c0",null,"c2","c3"]])")("string", arrString); | ||
} | ||
{ | ||
auto slice = arr->ISlice(8, 11); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([[null,null],[null,"b1","b2","b3",null],["c0",null,"c2","c3"]])")("string", arrString); | ||
} | ||
{ | ||
auto slice = arr->ISlice(8, 2); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([[null,null]])")("string", arrString); | ||
} | ||
{ | ||
auto slice = arr->ISlice(9, 3); | ||
const TString arrString = PrepareToCompare(slice->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([[null],[null,"b1"]])")("string", arrString); | ||
} | ||
} | ||
|
||
Y_UNIT_TEST(FilterSimple) { | ||
auto arr = BuildCompositeArray(); | ||
{ | ||
const TColumnFilter filter = TColumnFilter::BuildConstFilter(true, { 1, 2, 3, 4, 5, 4 }); | ||
|
||
auto filtered = arr->ApplyFilter(filter, arr); | ||
const TString arrString = PrepareToCompare(filtered->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([[null,"a3",null,null],[null,"b1","b2","b3",null]])")("string", arrString); | ||
} | ||
{ | ||
const TColumnFilter filter = TColumnFilter::BuildConstFilter(false, { 1, 2, 3, 4, 5, 4 }); | ||
|
||
auto filtered = arr->ApplyFilter(filter, arr); | ||
const TString arrString = PrepareToCompare(filtered->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([["a1",null,null,"a7",null,null],["c0",null,"c2","c3"]])")("string", arrString); | ||
} | ||
{ | ||
const TColumnFilter filter = TColumnFilter::BuildConstFilter(false, { 3, 1, 3, 1, 3, 1, 3, 1, 3 }); | ||
|
||
auto filtered = arr->ApplyFilter(filter, arr); | ||
const TString arrString = PrepareToCompare(filtered->GetChunkedArray()->ToString()); | ||
AFL_VERIFY(arrString == R"([["a3","a7"],["b1"],["c0"]])")("string", arrString); | ||
} | ||
} | ||
}; |
This file contains hidden or 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,19 @@ | ||
UNITTEST_FOR(ydb/core/formats/arrow/accessor/sparsed) | ||
|
||
SIZE(SMALL) | ||
|
||
PEERDIR( | ||
ydb/core/formats/arrow/accessor/sparsed | ||
ydb/core/formats/arrow/accessor/plain | ||
ydb/core/formats/arrow | ||
yql/essentials/public/udf/service/stub | ||
ydb/core/formats/arrow | ||
) | ||
|
||
YQL_LAST_ABI_VERSION() | ||
|
||
SRCS( | ||
ut_composite.cpp | ||
) | ||
|
||
END() |
This file contains hidden or 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 |
---|---|---|
|
@@ -10,3 +10,7 @@ SRCS( | |
) | ||
|
||
END() | ||
|
||
RECURSE_FOR_TESTS( | ||
ut | ||
) |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.