@@ -23,6 +23,7 @@ class TLineageScanner {
2323 for (auto & p : Ctx_.DataSources ) {
2424 if (p->IsRead (node)) {
2525 Reads_[&node] = p.Get ();
26+ HasReads_.emplace (&node);
2627 }
2728 }
2829
@@ -32,6 +33,15 @@ class TLineageScanner {
3233 }
3334 }
3435
36+ return true ;
37+ }, [&](const TExprNode& node) {
38+ for (const auto & child : node.Children ()) {
39+ if (HasReads_.contains (child.Get ())) {
40+ HasReads_.emplace (&node);
41+ break ;
42+ }
43+ }
44+
3545 return true ;
3646 });
3747
@@ -210,6 +220,27 @@ class TLineageScanner {
210220 return &lineage;
211221 }
212222
223+ if (!HasReads_.contains (&node)) {
224+ auto type = node.GetTypeAnn ();
225+ if (type->GetKind () == ETypeAnnotationKind::List) {
226+ auto itemType = type->Cast <TListExprType>()->GetItemType ();
227+ if (itemType->GetKind () == ETypeAnnotationKind::Struct) {
228+ auto structType = itemType->Cast <TStructExprType>();
229+ lineage.Fields .ConstructInPlace ();
230+ for (const auto & i : structType->GetItems ()) {
231+ if (i->GetName ().StartsWith (" _yql_sys_" )) {
232+ continue ;
233+ }
234+
235+ TString fieldName (i->GetName ());
236+ (*lineage.Fields ).emplace (fieldName, TFieldsLineage ());
237+ }
238+
239+ return &lineage;
240+ }
241+ }
242+ }
243+
213244 if (node.IsCallable ({
214245 " Unordered" ,
215246 " UnorderedSubquery" ,
@@ -828,6 +859,7 @@ class TLineageScanner {
828859 TNodeMap<TVector<ui32>> ReadIds_;
829860 TNodeMap<ui32> WriteIds_;
830861 TNodeMap<TLineage> Lineages_;
862+ TNodeSet HasReads_;
831863};
832864
833865}
0 commit comments