Skip to content

Commit

Permalink
[yql] Fix query cache for UDFs (YQL-17478) (ydb-platform#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvu1024 authored and adameat committed Dec 29, 2023
1 parent 3d40b45 commit 2cfb007
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions ydb/library/yql/providers/yt/lib/hash/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ PEERDIR(
ydb/library/yql/utils
ydb/library/yql/utils/log
ydb/library/yql/core
ydb/library/yql/core/expr_nodes
)

END()
7 changes: 5 additions & 2 deletions ydb/library/yql/providers/yt/lib/hash/yql_op_hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
#include "yql_hash_builder.h"

#include <ydb/library/yql/core/yql_type_annotation.h>
#include <ydb/library/yql/core/expr_nodes/yql_expr_nodes.h>
#include <ydb/library/yql/utils/log/log.h>
#include <ydb/library/yql/utils/yql_panic.h>

namespace NYql {

using namespace NNodes;

void TNodeHashCalculator::UpdateFileHash(THashBuilder& builder, TStringBuf alias) const {
auto block = Types.UserDataStorage->FindUserDataBlock(alias);
YQL_ENSURE(block, "File " << alias << " not found");
Expand Down Expand Up @@ -78,9 +81,9 @@ TString TNodeHashCalculator::GetHashImpl(const TExprNode& node, TArgIndex& argIn
isHashable = false;
}
else {
if (node.Content() == "Udf" && node.ChildrenSize() == 7 && !node.Child(6)->Content().empty()) {
if (TCoUdf::Match(&node) && node.ChildrenSize() > TCoUdf::idx_FileAlias && !node.Child(TCoUdf::idx_FileAlias)->Content().empty()) {
// an udf from imported file, use hash of file
auto alias = node.Child(6)->Content();
auto alias = node.Child(TCoUdf::idx_FileAlias)->Content();
UpdateFileHash(builder, alias);
} else if (node.Content() == "FilePath" || node.Content() == "FileContent") {
auto alias = node.Child(0)->Content();
Expand Down

0 comments on commit 2cfb007

Please sign in to comment.