Skip to content

Commit ab860da

Browse files
committed
[yql] Fix query cache for UDFs (YQL-17478)
1 parent 53259c9 commit ab860da

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ydb/library/yql/providers/yt/lib/hash/ya.make

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PEERDIR(
1111
ydb/library/yql/utils
1212
ydb/library/yql/utils/log
1313
ydb/library/yql/core
14+
ydb/library/yql/core/expr_nodes
1415
)
1516

1617
END()

ydb/library/yql/providers/yt/lib/hash/yql_op_hash.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#include "yql_hash_builder.h"
33

44
#include <ydb/library/yql/core/yql_type_annotation.h>
5+
#include <ydb/library/yql/core/expr_nodes/yql_expr_nodes.h>
56
#include <ydb/library/yql/utils/log/log.h>
67
#include <ydb/library/yql/utils/yql_panic.h>
78

89
namespace NYql {
910

11+
using namespace NNodes;
12+
1013
void TNodeHashCalculator::UpdateFileHash(THashBuilder& builder, TStringBuf alias) const {
1114
auto block = Types.UserDataStorage->FindUserDataBlock(alias);
1215
YQL_ENSURE(block, "File " << alias << " not found");
@@ -78,9 +81,9 @@ TString TNodeHashCalculator::GetHashImpl(const TExprNode& node, TArgIndex& argIn
7881
isHashable = false;
7982
}
8083
else {
81-
if (node.Content() == "Udf" && node.ChildrenSize() == 7 && !node.Child(6)->Content().empty()) {
84+
if (TCoUdf::Match(&node) && node.ChildrenSize() > TCoUdf::idx_FileAlias && !node.Child(TCoUdf::idx_FileAlias)->Content().empty()) {
8285
// an udf from imported file, use hash of file
83-
auto alias = node.Child(6)->Content();
86+
auto alias = node.Child(TCoUdf::idx_FileAlias)->Content();
8487
UpdateFileHash(builder, alias);
8588
} else if (node.Content() == "FilePath" || node.Content() == "FileContent") {
8689
auto alias = node.Child(0)->Content();

0 commit comments

Comments
 (0)