aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraozeritsky <aozeritsky@ydb.tech>2023-09-23 20:14:27 +0300
committeraozeritsky <aozeritsky@ydb.tech>2023-09-23 20:29:44 +0300
commitacb22b200ac691d8b7ab3e38b7e5c3ec94e433da (patch)
tree5d3817210d1b2061141ba1db093796c50898305b
parenta0cc0980e5b84566a2a6ec219dbde9b6182da47a (diff)
downloadydb-acb22b200ac691d8b7ab3e38b7e5c3ec94e433da.tar.gz
Less data copy
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_join.h2
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp6
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_join_cost_based_generic.cpp10
-rw-r--r--ydb/library/yql/dq/opt/dq_opt_log.h2
4 files changed, 10 insertions, 10 deletions
diff --git a/ydb/library/yql/dq/opt/dq_opt_join.h b/ydb/library/yql/dq/opt/dq_opt_join.h
index 814be59e8a8..8d83b2de646 100644
--- a/ydb/library/yql/dq/opt/dq_opt_join.h
+++ b/ydb/library/yql/dq/opt/dq_opt_join.h
@@ -27,7 +27,7 @@ NNodes::TDqJoin DqSuppressSortOnJoinInput(const NNodes::TDqJoin& node, TExprCont
bool DqCollectJoinRelationsWithStats(
TTypeAnnotationContext& typesCtx,
const NNodes::TCoEquiJoin& equiJoin,
- const std::function<void(const TString&, const std::shared_ptr<TOptimizerStatistics>&)>& collector);
+ const std::function<void(TStringBuf, const std::shared_ptr<TOptimizerStatistics>&)>& collector);
} // namespace NDq
} // namespace NYql
diff --git a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp
index b581859b7c8..6dd1fd66421 100644
--- a/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp
+++ b/ydb/library/yql/dq/opt/dq_opt_join_cost_based.cpp
@@ -843,7 +843,7 @@ TExprBase RearrangeEquiJoinTree(TExprContext& ctx, const TCoEquiJoin& equiJoin,
bool DqCollectJoinRelationsWithStats(
TTypeAnnotationContext& typesCtx,
const TCoEquiJoin& equiJoin,
- const std::function<void(const TString&, const std::shared_ptr<TOptimizerStatistics>&)>& collector)
+ const std::function<void(TStringBuf, const std::shared_ptr<TOptimizerStatistics>&)>& collector)
{
if (equiJoin.ArgCount() < 3) {
return false;
@@ -869,7 +869,7 @@ bool DqCollectJoinRelationsWithStats(
return false;
}
- auto label = scope.Cast<TCoAtom>().StringValue();
+ TStringBuf label = scope.Cast<TCoAtom>();
auto stats = maybeStat->second;
collector(label, stats);
}
@@ -917,7 +917,7 @@ TExprBase DqOptimizeEquiJoinWithCosts(const TExprBase& node, TExprContext& ctx,
// The arguments of the EquiJoin are 1..n-2, n-2 is the actual join tree
// of the EquiJoin and n-1 argument are the parameters to EquiJoin
if (!DqCollectJoinRelationsWithStats(typesCtx, equiJoin, [&](auto label, auto stat) {
- rels.emplace_back(std::make_shared<TRelOptimizerNode>(label, stat));
+ rels.emplace_back(std::make_shared<TRelOptimizerNode>(TString(label), stat));
})) {
return node;
}
diff --git a/ydb/library/yql/dq/opt/dq_opt_join_cost_based_generic.cpp b/ydb/library/yql/dq/opt/dq_opt_join_cost_based_generic.cpp
index ee4e100a1ca..ec3b6b1209f 100644
--- a/ydb/library/yql/dq/opt/dq_opt_join_cost_based_generic.cpp
+++ b/ydb/library/yql/dq/opt/dq_opt_join_cost_based_generic.cpp
@@ -14,9 +14,9 @@ namespace {
struct TState {
IOptimizer::TInput Input;
IOptimizer::TOutput Result;
- std::vector<TString> Tables; // relId -> table
- std::vector<THashMap<TString, int>> VarIds; // relId -> varsIds
- THashMap<TString, std::vector<int>> Table2RelIds;
+ std::vector<TStringBuf> Tables; // relId -> table
+ std::vector<THashMap<TStringBuf, int>> VarIds; // relId -> varsIds
+ THashMap<TStringBuf, std::vector<int>> Table2RelIds;
std::vector<std::vector<std::tuple<TStringBuf, TStringBuf>>> Var2TableCol; // relId, varId -> table, col
TPositionHandle Pos;
@@ -38,7 +38,7 @@ struct TState {
return varId;
}
- void CollectRel(const TString& label, auto stat) {
+ void CollectRel(TStringBuf label, auto stat) {
Input.Rels.emplace_back();
Var2TableCol.emplace_back();
VarIds.emplace_back();
@@ -158,7 +158,7 @@ TExprBase DqOptimizeEquiJoinWithCosts(
const TExprBase& node,
TExprContext& ctx,
TTypeAnnotationContext& typesCtx,
- const std::function<IOptimizer*(IOptimizer::TInput&&)> optFactory,
+ const std::function<IOptimizer*(IOptimizer::TInput&&)>& optFactory,
bool ruleEnabled)
{
Y_UNUSED(ctx);
diff --git a/ydb/library/yql/dq/opt/dq_opt_log.h b/ydb/library/yql/dq/opt/dq_opt_log.h
index 52cfd8a8494..8d61c097f1d 100644
--- a/ydb/library/yql/dq/opt/dq_opt_log.h
+++ b/ydb/library/yql/dq/opt/dq_opt_log.h
@@ -25,7 +25,7 @@ NNodes::TExprBase DqOptimizeEquiJoinWithCosts(
const NNodes::TExprBase& node,
TExprContext& ctx,
TTypeAnnotationContext& typesCtx,
- const std::function<IOptimizer*(IOptimizer::TInput&&)> optFactory,
+ const std::function<IOptimizer*(IOptimizer::TInput&&)>& optFactory,
bool ruleEnabled);
NNodes::TExprBase DqRewriteEquiJoin(const NNodes::TExprBase& node, TExprContext& ctx);