Browse Source

Fix empty table name error (#8907)

Vadim Averin 6 months ago
parent
commit
29df886f76

+ 7 - 2
ydb/library/yql/providers/yt/provider/yql_yt_io_discovery.cpp

@@ -152,8 +152,13 @@ public:
                             .Name().Value(ToString(EYtSettingType::Anonymous)).Build()
                         .Build()
                         .Done();
-                } else if (tableInfo.Name.StartsWith("//")) {
-                    tableInfo.Name = tableInfo.Name.substr(2);
+                } else if (tableInfo.Name.StartsWith(NYT::TConfig::Get()->Prefix)) {
+                    tableInfo.Name = tableInfo.Name.substr(NYT::TConfig::Get()->Prefix.size());
+                }
+
+                if (tableInfo.Name.empty()) {
+                    ctx.AddError(TIssue(ctx.GetPosition(write.Pos()), "Table name must not be empty"));
+                    return {};
                 }
 
                 if (flush) {

+ 0 - 4
ydb/library/yql/providers/yt/provider/yql_yt_key.cpp

@@ -142,10 +142,6 @@ bool TYtKey::Parse(const TExprNode& key, TExprContext& ctx, bool isOutput) {
 
         const TExprNode* tableName = nameNode->Child(0);
 
-        if (tableName->Content().empty()) {
-            ctx.AddError(TIssue(ctx.GetPosition(tableName->Pos()), "Table name must not be empty"));
-            return false;
-        }
         Path = tableName->Content();
     }
     else if (nameNode->IsCallable(MrTableRangeName) || nameNode->IsCallable(MrTableRangeStrictName)) {