diff options
| author | Sergey Uzhakov <[email protected]> | 2026-07-19 12:07:31 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-07-19 12:07:31 +0300 |
| commit | 3a7f9024b732387a9a3ee83095a71afa82244f6f (patch) | |
| tree | 7f6920eb7a2dea3a1a17c4361e031b690ffb8e75 | |
| parent | 549ed3d20348930d2abbdadb0d61e26b4260d05d (diff) | |
| -rw-r--r-- | ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp index fe6c7cebc70..6216abea8ad 100644 --- a/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp +++ b/ydb/library/yql/providers/dq/provider/exec/yql_dq_exectransformer.cpp @@ -522,7 +522,8 @@ private: pathWithMd5.Md5); } - bool BuildUploadList( + // Returns formatted error message if attachments exceed the limit; empty string otherwise. + TString BuildUploadList( TUploadList* uploadList, bool localRun, TString* lambda, @@ -537,7 +538,7 @@ private: return ret; } - bool BuildUploadList( + TString BuildUploadList( TUploadList* uploadList, bool localRun, TExploringNodeVisitor& explorer, @@ -581,7 +582,6 @@ private: uploadList->emplace(f); } } - bool fallbackFlag = false; for (TNode* node : explorer.GetNodes()) { node->Freeze(typeEnv); @@ -733,11 +733,17 @@ private: i64 dataLimit = static_cast<i64>(State->Settings->_MaxAttachmentsSize.Get().GetOrElse(TDqSettings::TDefault::MaxAttachmentsSize)); if (sizeSum > dataLimit) { - YQL_CLOG(WARN, ProviderDq) << "Too much data: " << sizeSum << " > " << dataLimit; - fallbackFlag = true; + const auto filesCount = uploadList->size(); + YQL_CLOG(WARN, ProviderDq) << "Too much data: " << filesCount << " file(s), " << sizeSum << " > " << dataLimit; + // Keep the "Too big attachment" prefix — analytics tools parse it. + return TStringBuilder() + << "Too big attachment: " << filesCount + << " file(s) attached with a total size of " + << sizeSum << " bytes, which exceeds the limit of " + << dataLimit << " bytes"; } - return fallbackFlag; + return {}; } TStatusCallbackPair GetLambda( @@ -822,10 +828,8 @@ private: } const bool localRun = enableLocalRun && (!State->DqGateway || (!*untrustedUdfFlag && !State->TypeCtx->ForceDq && !hasGraphParams)); - bool fallbackFlag = BuildUploadList(uploadList, localRun, explorer, typeEnv, files); - - if (fallbackFlag) { - YQL_CLOG(TRACE, ProviderDq) << "Fallback: " << NCommon::ExprToPrettyString(ctx, *input); + if (auto error = BuildUploadList(uploadList, localRun, explorer, typeEnv, files)) { + YQL_CLOG(TRACE, ProviderDq) << "Fallback: " << error << ": " << NCommon::ExprToPrettyString(ctx, *input); return Fallback(); } else { *lambda = SerializeRuntimeNode(root, typeEnv); @@ -1428,7 +1432,6 @@ private: return SyncStatus(FallbackWithMessage(pull.Ref(), err, ctx, true)); } - bool fallbackFlag = false; if (executionPlanner->MaxDataSizePerJob() > maxDataSizePerJob && canFallback) { return SyncStatus(FallbackWithMessage( pull.Ref(), @@ -1451,13 +1454,17 @@ private: return SyncError(); } + TString tooBigAttachmentError; { TScopedAlloc alloc(__LOCATION__, NKikimr::TAlignedPagePoolCounters(), State->FunctionRegistry->SupportsSizedAllocators()); TTypeEnvironment typeEnv(alloc); for (auto& t : tasks) { TUploadList uploadList; TString lambda = t.GetProgram().GetRaw(); - fallbackFlag |= BuildUploadList(&uploadList, localRun, &lambda, typeEnv, files); + if (auto error = BuildUploadList(&uploadList, localRun, &lambda, typeEnv, files)) { + tooBigAttachmentError = error; + break; + } t.MutableProgram()->SetRaw(lambda); t.MutableProgram()->SetLangVer(State->TypeCtx->LangVer); *t.MutableProgram()->MutableRuntimeSettings() = NYql::SerializeRuntimeSettingsToProto(*State->TypeCtx->RuntimeSettings); @@ -1475,8 +1482,8 @@ private: MarkProgressStarted(publicIds->AllPublicIds, State->ProgressWriter); - if (fallbackFlag) { - return SyncStatus(FallbackWithMessage(pull.Ref(), "Too big attachment", ctx, true)); + if (tooBigAttachmentError) { + return SyncStatus(FallbackWithMessage(pull.Ref(), tooBigAttachmentError, ctx, true)); } IDataProvider::TFillSettings fillSettings = NCommon::GetFillSettings(pull.Ref()); @@ -1984,7 +1991,6 @@ private: return FallbackWithMessage(*input, err, ctx, false); } - bool fallbackFlag = false; if (executionPlanner->MaxDataSizePerJob() > maxDataSizePerJob && canFallback) { return FallbackWithMessage( *input, @@ -2006,13 +2012,17 @@ private: return IGraphTransformer::TStatus::Error; } + TString tooBigAttachmentError; { TScopedAlloc alloc(__LOCATION__, NKikimr::TAlignedPagePoolCounters(), State->FunctionRegistry->SupportsSizedAllocators()); TTypeEnvironment typeEnv(alloc); for (auto& t : tasks) { TUploadList uploadList; TString lambda = t.GetProgram().GetRaw(); - fallbackFlag |= BuildUploadList(&uploadList, false, &lambda, typeEnv, files); + if (auto error = BuildUploadList(&uploadList, false, &lambda, typeEnv, files)) { + tooBigAttachmentError = error; + break; + } t.MutableProgram()->SetRaw(lambda); t.MutableProgram()->SetLangVer(State->TypeCtx->LangVer); *t.MutableProgram()->MutableRuntimeSettings() = NYql::SerializeRuntimeSettingsToProto(*State->TypeCtx->RuntimeSettings); @@ -2028,8 +2038,8 @@ private: } } - if (fallbackFlag) { - return FallbackWithMessage(*input, "Too big attachment", ctx, false); + if (tooBigAttachmentError) { + return FallbackWithMessage(*input, tooBigAttachmentError, ctx, false); } if (State->Metrics) { |
