@@ -453,18 +453,26 @@ class TYtFileGateway : public IYtGateway {
453
453
auto pos = options.Pos ();
454
454
try {
455
455
TSession* session = GetSession (options);
456
+
456
457
TSet<TString> uniqueTables;
457
- if (options.Prefix ().empty () && options.Suffix ().empty ()) {
458
- for (auto & x : Services_->GetTablesMapping ()) {
459
- TVector<TString> parts;
460
- Split (x.first , " ." , parts);
461
- if (parts.size () > 2 && parts[0 ] == YtProviderName) {
462
- if (!parts[2 ].StartsWith (TStringBuf (" Input" ))) {
463
- continue ;
464
- }
465
- uniqueTables.insert (parts[2 ]);
466
- }
458
+ const auto fullPrefix = options.Prefix ().Empty () ? TString () : (options.Prefix () + ' /' );
459
+ const auto fullSuffix = options.Suffix ().Empty () ? TString () : (' /' + options.Suffix ());
460
+ for (const auto & [tableName, _] : Services_->GetTablesMapping ()) {
461
+ TVector<TString> parts;
462
+ Split (tableName, " ." , parts);
463
+ if (parts.size () != 3 ) {
464
+ continue ;
465
+ }
466
+ if (parts[0 ] != YtProviderName || parts[1 ] != options.Cluster ()) {
467
+ continue ;
468
+ }
469
+ if (!parts[2 ].StartsWith (fullPrefix)) {
470
+ continue ;
471
+ }
472
+ if (!parts[2 ].EndsWith (fullSuffix)) {
473
+ continue ;
467
474
}
475
+ uniqueTables.insert (parts[2 ]);
468
476
}
469
477
470
478
TTableRangeResult res;
@@ -484,8 +492,11 @@ class TYtFileGateway : public IYtGateway {
484
492
TProgramBuilder pgmBuilder (builder.GetTypeEnvironment (), *Services_->GetFunctionRegistry ());
485
493
486
494
TVector<TRuntimeNode> strings;
487
- for (auto & x: uniqueTables) {
488
- strings.push_back (pgmBuilder.NewDataLiteral <NUdf::EDataSlot::String>(x));
495
+ for (auto & tableName: uniqueTables) {
496
+ auto stripped = TStringBuf (tableName);
497
+ stripped.SkipPrefix (fullPrefix);
498
+ stripped.ChopSuffix (fullSuffix);
499
+ strings.push_back (pgmBuilder.NewDataLiteral <NUdf::EDataSlot::String>(TString (stripped)));
489
500
}
490
501
491
502
auto inputNode = pgmBuilder.AsList (strings);
@@ -504,7 +515,10 @@ class TYtFileGateway : public IYtGateway {
504
515
const auto & value = compGraph->GetValue ();
505
516
const auto it = value.GetListIterator ();
506
517
for (NUdf::TUnboxedValue current; it.Next (current);) {
507
- res.Tables .push_back (TCanonizedPath{TString (current.AsStringRef ()), Nothing (), {}, Nothing ()});
518
+ TString tableName = TString (current.AsStringRef ());
519
+ tableName.prepend (fullPrefix);
520
+ tableName.append (fullSuffix);
521
+ res.Tables .push_back (TCanonizedPath{std::move (tableName), Nothing (), {}, Nothing ()});
508
522
}
509
523
}
510
524
else {
@@ -527,17 +541,20 @@ class TYtFileGateway : public IYtGateway {
527
541
auto pos = options.Pos ();
528
542
try {
529
543
TSet<TString> uniqueTables;
530
- if (options.Prefix ().empty ()) {
531
- for (auto & x : Services_->GetTablesMapping ()) {
532
- TVector<TString> parts;
533
- Split (x.first , " ." , parts);
534
- if (parts.size () > 2 && parts[0 ] == YtProviderName) {
535
- if (!parts[2 ].StartsWith (TStringBuf (" Input" ))) {
536
- continue ;
537
- }
538
- uniqueTables.insert (parts[2 ]);
539
- }
544
+ const auto fullPrefix = options.Prefix ().Empty () ? " " : (options.Prefix () + ' /' );
545
+ for (const auto & [tableName, _] : Services_->GetTablesMapping ()) {
546
+ TVector<TString> parts;
547
+ Split (tableName, " ." , parts);
548
+ if (parts.size () != 3 ) {
549
+ continue ;
550
+ }
551
+ if (parts[0 ] != YtProviderName || parts[1 ] != options.Cluster ()) {
552
+ continue ;
553
+ }
554
+ if (!parts[2 ].StartsWith (fullPrefix)) {
555
+ continue ;
540
556
}
557
+ uniqueTables.insert (parts[2 ]);
541
558
}
542
559
543
560
TVector<TFolderResult::TFolderItem> items;
0 commit comments