@@ -972,14 +972,19 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TStringBuf datab
972
972
TKikimrKey key (ctx);
973
973
YQL_ENSURE (key.Extract (content.TableKey ().Ref ()));
974
974
975
- auto showCreateValue = Build<TCoNameValueTuple>(ctx, node.Pos ())
975
+ auto sysViewRewrittenValue = Build<TCoNameValueTuple>(ctx, node.Pos ())
976
976
.Name ()
977
- .Build (" showCreateTable " )
977
+ .Build (" sysViewRewritten " )
978
978
.Value <TCoAtom>()
979
979
.Value (key.GetTablePath ())
980
980
.Build ()
981
981
.Done ();
982
982
983
+ auto showCreateTableValue = Build<TCoNameValueTuple>(ctx, node.Pos ())
984
+ .Name ()
985
+ .Build (" showCreateTable" )
986
+ .Done ();
987
+
983
988
auto showCreateTableRead = Build<TCoRead>(ctx, node.Pos ())
984
989
.World <TCoWorld>().Build ()
985
990
.DataSource <TCoDataSource>()
@@ -992,7 +997,8 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TStringBuf datab
992
997
.Add (newKey)
993
998
.Add (ctx.NewCallable (node.Pos (), " Void" , {}))
994
999
.Add (ctx.NewList (node.Pos (), {}))
995
- .Add (showCreateValue)
1000
+ .Add (sysViewRewrittenValue)
1001
+ .Add (showCreateTableValue)
996
1002
.Build ()
997
1003
.Done ().Ptr ();
998
1004
@@ -1009,14 +1015,21 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TStringBuf datab
1009
1015
auto right = rightMaybe.Cast ();
1010
1016
if (auto maybeRead = right.Input ().Maybe <TCoRead>()) {
1011
1017
auto read = maybeRead.Cast ();
1018
+ bool isSysViewRewritten = false ;
1019
+ bool isShowCreateTable = false ;
1012
1020
for (auto arg : read .FreeArgs ()) {
1013
1021
if (auto tuple = arg.Maybe <TCoNameValueTuple>()) {
1014
1022
auto name = tuple.Cast ().Name ().Value ();
1015
- if (name == " showCreateTable" ) {
1016
- showCreateTableRightReplaces[input.Get ()] = nullptr ;
1023
+ if (name == " sysViewRewritten" ) {
1024
+ isSysViewRewritten = true ;
1025
+ } else if (name == " showCreateTable" ) {
1026
+ isShowCreateTable = true ;
1017
1027
}
1018
1028
}
1019
1029
}
1030
+ if (isShowCreateTable && isSysViewRewritten) {
1031
+ showCreateTableRightReplaces[input.Get ()] = nullptr ;
1032
+ }
1020
1033
}
1021
1034
}
1022
1035
return true ;
@@ -1030,7 +1043,7 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TStringBuf datab
1030
1043
for (auto arg : read .FreeArgs ()) {
1031
1044
if (auto tuple = arg.Maybe <TCoNameValueTuple>()) {
1032
1045
auto name = tuple.Cast ().Name ().Value ();
1033
- if (name == " showCreateTable " ) {
1046
+ if (name == " sysViewRewritten " ) {
1034
1047
tablePath = tuple.Cast ().Value ().Cast ().Cast <TCoAtom>().StringValue ();
1035
1048
}
1036
1049
}
@@ -1109,7 +1122,7 @@ TExprNode::TPtr KiBuildQuery(TExprBase node, TExprContext& ctx, TStringBuf datab
1109
1122
.Repeat (TExprStep::LoadTablesMetadata)
1110
1123
.Repeat (TExprStep::RewriteIO);
1111
1124
1112
- return ctx.ReplaceNodes (std::move (resNode.Ptr ()), showCreateTableRightReplaces);;
1125
+ return ctx.ReplaceNodes (std::move (resNode.Ptr ()), showCreateTableRightReplaces);
1113
1126
}
1114
1127
1115
1128
TKiExploreTxResults txExplore;
0 commit comments