Skip to content

Commit

Permalink
initial implementation of QStorage over Ydb (ydb-platform#4128)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitstn authored Apr 27, 2024
1 parent 9d1cd27 commit 3d12c62
Show file tree
Hide file tree
Showing 7 changed files with 480 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ void QStorageTestInterleaveReadWrite_Impl(const NYql::IQStoragePtr& storage);
#define GENERATE_ONE_TEST(NAME, FACTORY) \
Y_UNIT_TEST(NAME) { \
auto storage = FACTORY(); \
QStorageTest##NAME##_Impl(storage); \
if (storage) { \
QStorageTest##NAME##_Impl(storage); \
} \
}

#define GENERATE_TESTS(FACTORY)\
Expand All @@ -21,4 +23,3 @@ void QStorageTestInterleaveReadWrite_Impl(const NYql::IQStoragePtr& storage);
GENERATE_ONE_TEST(IterateWithoutValue, FACTORY) \
GENERATE_ONE_TEST(ManyKeys, FACTORY) \
GENERATE_ONE_TEST(InterleaveReadWrite, FACTORY)

1 change: 1 addition & 0 deletions ydb/library/yql/core/qplayer/storage/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ RECURSE(
interface
memory
ut_common
ydb
)

11 changes: 11 additions & 0 deletions ydb/library/yql/core/qplayer/storage/ydb/ut/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
UNITTEST_FOR(ydb/library/yql/core/qplayer/storage/ydb)

SRCS(
yql_qstorage_ydb_ut.cpp
)

PEERDIR(
ydb/library/yql/core/qplayer/storage/ut_common
)

END()
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <ydb/library/yql/core/qplayer/storage/ydb/yql_qstorage_ydb.h>

#include <library/cpp/testing/unittest/registar.h>

#include <ydb/library/yql/core/qplayer/storage/ut_common/yql_qstorage_ut_common.h>

#include <util/generic/guid.h>
#include <util/system/env.h>

using namespace NYql;

IQStoragePtr MakeTestYdbQStorage() {
TYdbQStorageSettings settings;
settings.Token = GetEnv("YDB_TOKEN");
settings.Endpoint = GetEnv("YDB_QSTORAGE_ENDPOINT");
if (!settings.Endpoint) {
Cerr << "YDB_QSTORAGE_ENDPOINT is not set";
return nullptr;
}

settings.Database = GetEnv("YDB_QSTORAGE_DATABASE");
settings.TablesPrefix = GetEnv("YDB_QSTORAGE_TABLES_PREFIX");
settings.OperationIdPrefix = CreateGuidAsString() + "_";
settings.PartBytes = 2;
settings.MaxBatchSize = 30;
return MakeYdbQStorage(settings);
}

Y_UNIT_TEST_SUITE(TQStorageFileTests) {
GENERATE_TESTS(MakeTestYdbQStorage)
}
18 changes: 18 additions & 0 deletions ydb/library/yql/core/qplayer/storage/ydb/ya.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
LIBRARY()

SRCS(
yql_qstorage_ydb.cpp
)

PEERDIR(
ydb/library/yql/core/qplayer/storage/interface
ydb/library/yql/core/qplayer/storage/memory
ydb/public/sdk/cpp/client/ydb_table
library/cpp/digest/old_crc
)

END()

RECURSE_FOR_TESTS(
ut
)
Loading

0 comments on commit 3d12c62

Please sign in to comment.