Skip to content

Commit 8ee38ab

Browse files
authored
Move yql/tests/sql/kikimr_tpch/ to github (#7498)
1 parent 2f95ed9 commit 8ee38ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+12700
-0
lines changed

ydb/core/kqp/tests/kikimr_tpch/kqp_tpch_ut.cpp

Lines changed: 984 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
UNITTEST()
2+
3+
#INCLUDE(${ARCADIA_ROOT}/kikimr/public/tools/ydb_recipe/recipe.inc)
4+
5+
TAG(ya:manual)
6+
7+
DEPENDS(
8+
# kikimr/driver
9+
ydb/public/tools/ydb_recipe
10+
# contrib/tools/python
11+
ydb/library/yql/udfs/common/datetime
12+
ydb/library/yql/udfs/common/datetime2
13+
ydb/library/yql/udfs/common/pire
14+
ydb/library/yql/udfs/common/re2
15+
ydb/library/yql/udfs/common/string
16+
)
17+
18+
USE_RECIPE(
19+
ydb/public/tools/ydb_recipe/ydb_recipe
20+
--suppress-version-check
21+
# --debug-logging KQP_YQL KQP_GATEWAY KQP_COMPUTE KQP_TASKS_RUNNER KQP_EXECUTER KQP_WORKER KQP_PROXY TABLET_EXECUTOR
22+
)
23+
24+
SRCS(
25+
kqp_tpch_ut.cpp
26+
)
27+
28+
PEERDIR(
29+
ydb/core/kqp/tests/tpch/lib
30+
library/cpp/testing/unittest
31+
ydb/core/protos
32+
ydb/library/grpc/client
33+
ydb/library/yql/public/udf/service/stub
34+
ydb/public/lib/yson_value
35+
)
36+
37+
SIZE(MEDIUM)
38+
39+
END()

ydb/core/kqp/tests/tpch/cmd_drop.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "cmd_drop.h"
2+
3+
#include <ydb/core/kqp/tests/tpch/lib/tpch_runner.h>
4+
5+
6+
namespace NYdb::NTpch {
7+
8+
TCommandDrop::TCommandDrop()
9+
: TTpchCommandBase("drop", {"d"}, "Drop YDB database")
10+
{}
11+
12+
void TCommandDrop::Config(TConfig&) {
13+
}
14+
15+
int TCommandDrop::Run(TConfig& config) {
16+
auto driver = CreateDriver(config);
17+
TTpchRunner tpch{driver, Path};
18+
NTable::TTableClient tableClient(driver);
19+
tpch.DropTables(tableClient, true /* removeDir */);
20+
driver.Stop(true);
21+
return 0;
22+
}
23+
24+
} // namespace NYdb::NTpch

ydb/core/kqp/tests/tpch/cmd_drop.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#include "commands.h"
4+
5+
6+
namespace NYdb::NTpch {
7+
8+
class TCommandDrop : public TTpchCommandBase {
9+
public:
10+
TCommandDrop();
11+
12+
void Config(TConfig& config) override;
13+
int Run(TConfig& config) override;
14+
};
15+
16+
} // namespace NYdb::NTpch
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#include "cmd_prepare.h"
2+
3+
#include <ydb/core/kqp/tests/tpch/lib/tpch_runner.h>
4+
5+
6+
namespace NYdb::NTpch {
7+
8+
TCommandPrepare::TCommandPrepare()
9+
: TTpchCommandBase("prepare", {"p"}, "Prepare YDB database")
10+
{}
11+
12+
void TCommandPrepare::Config(TConfig& config) {
13+
config.Opts->AddLongOption('s', "source", "Path to directory with source tables (*.tbl files)")
14+
.Required()
15+
.StoreResult(&SrcDataPath);
16+
config.Opts->AddLongOption('p', "partition-size", "Partition size (in MB)")
17+
.Required()
18+
.StoreResult(&PartitionSize);
19+
config.Opts->AddLongOption('b', "batch", "Uploading batch size (default 1000)")
20+
.Optional()
21+
.StoreResult(&BatchSize);
22+
config.SetFreeArgsNum(0);
23+
}
24+
25+
int TCommandPrepare::Run(TConfig& config) {
26+
auto driver = CreateDriver(config);
27+
TTpchRunner tpch{driver, Path};
28+
tpch.UploadData(SrcDataPath, PartitionSize, BatchSize);
29+
driver.Stop(true);
30+
return 0;
31+
}
32+
33+
} // namespace NYdb::NTpch

ydb/core/kqp/tests/tpch/cmd_prepare.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
3+
#include "commands.h"
4+
5+
6+
namespace NYdb::NTpch {
7+
8+
class TCommandPrepare : public TTpchCommandBase {
9+
public:
10+
TCommandPrepare();
11+
12+
void Config(TConfig& config) override;
13+
int Run(TConfig& config) override;
14+
15+
private:
16+
TString SrcDataPath;
17+
ui32 PartitionSize = 0;
18+
ui32 BatchSize = 1000;
19+
};
20+
21+
} // namespace NYdb::NTpch
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "cmd_prepare_scheme.h"
2+
3+
#include <ydb/core/kqp/tests/tpch/lib/tpch_runner.h>
4+
5+
#include <util/string/split.h>
6+
7+
namespace NYdb::NTpch {
8+
9+
TCommandPrepareScheme::TCommandPrepareScheme()
10+
: TTpchCommandBase("prepare-scheme", {"ps"}, "Prepare YDB database scheme only")
11+
{}
12+
13+
void TCommandPrepareScheme::Config(TConfig& config) {
14+
config.Opts->AddLongOption('p', "partitions", "Uniform partitions count in comma-separated key=value format.\n"
15+
"Ex.: -p nation=1,lineitem=10,...")
16+
.Optional()
17+
.Handler1T<TStringBuf>([this](TStringBuf opt) {
18+
for (TStringBuf kv : StringSplitter(opt).Split(',').SkipEmpty()) {
19+
TStringBuf table, partitions;
20+
kv.Split('=', table, partitions);
21+
TablePartitions.emplace(table, FromString<ui32>(partitions));
22+
}
23+
});
24+
config.SetFreeArgsNum(0);
25+
}
26+
27+
int TCommandPrepareScheme::Run(TConfig& config) {
28+
auto driver = CreateDriver(config);
29+
TTpchRunner tpch{driver, Path};
30+
tpch.CreateTables(TablePartitions, true);
31+
driver.Stop(true);
32+
return 0;
33+
}
34+
35+
} // namespace NYdb::NTpch
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
3+
#include "commands.h"
4+
5+
6+
namespace NYdb::NTpch {
7+
8+
class TCommandPrepareScheme : public TTpchCommandBase {
9+
public:
10+
TCommandPrepareScheme();
11+
12+
void Config(TConfig& config) override;
13+
int Run(TConfig& config) override;
14+
15+
private:
16+
TMap<TString, ui32> TablePartitions;
17+
};
18+
19+
} // namespace NYdb::NTpch

0 commit comments

Comments
 (0)