@@ -102,23 +102,48 @@ class TKiSourceIntentDeterminationTransformer: public TKiSourceVisitorTransforme
102
102
103
103
private:
104
104
TStatus HandleKiRead (TKiReadBase node, TExprContext& ctx) override {
105
+ bool showCreateTableRewritten = false ;
106
+ TExprBase currentNode (node);
107
+ if (auto maybeReadTable = currentNode.Maybe <TKiReadTable>()) {
108
+ auto readTable = maybeReadTable.Cast ();
109
+ for (auto setting : readTable.Settings ()) {
110
+ auto name = setting.Name ().Value ();
111
+ if (name == " showCreateTableRewritten" ) {
112
+ showCreateTableRewritten = true ;
113
+ }
114
+ }
115
+ }
116
+
105
117
auto cluster = node.DataSource ().Cluster ();
106
118
TKikimrKey key (ctx);
107
119
if (!key.Extract (node.TableKey ().Ref ())) {
108
120
return TStatus::Error;
109
121
}
110
122
111
- return HandleKey (cluster, key);
123
+ return HandleKey (cluster, key, showCreateTableRewritten );
112
124
}
113
125
114
126
TStatus HandleRead (TExprBase node, TExprContext& ctx) override {
127
+ bool showCreateTableRewritten = false ;
128
+ if (auto maybeRead = node.Maybe <TCoRead>()) {
129
+ auto read = maybeRead.Cast ();
130
+ for (auto arg : read .FreeArgs ()) {
131
+ if (auto maybeTuple = arg.Maybe <TCoNameValueTuple>()) {
132
+ auto tuple = maybeTuple.Cast ();
133
+ if (tuple.Ref ().Child (0 )->Content () == " showCreateTableRewritten" ) {
134
+ showCreateTableRewritten = true ;
135
+ }
136
+ }
137
+ }
138
+ }
139
+
115
140
auto cluster = node.Ref ().Child (1 )->Child (1 )->Content ();
116
141
TKikimrKey key (ctx);
117
142
if (!key.Extract (*node.Ref ().Child (2 ))) {
118
143
return TStatus::Error;
119
144
}
120
145
121
- return HandleKey (cluster, key);
146
+ return HandleKey (cluster, key, showCreateTableRewritten );
122
147
}
123
148
124
149
TStatus HandleLength (TExprBase node, TExprContext& ctx) override {
@@ -134,12 +159,12 @@ class TKiSourceIntentDeterminationTransformer: public TKiSourceVisitorTransforme
134
159
}
135
160
136
161
private:
137
- TStatus HandleKey (const TStringBuf& cluster, const TKikimrKey& key) {
162
+ TStatus HandleKey (const TStringBuf& cluster, const TKikimrKey& key, bool showCreate = false ) {
138
163
switch (key.GetKeyType ()) {
139
164
case TKikimrKey::Type::Table:
140
165
case TKikimrKey::Type::TableScheme: {
141
166
auto & table = SessionCtx->Tables ().GetOrAddTable (TString (cluster), SessionCtx->GetDatabase (),
142
- key.GetTablePath ());
167
+ key.GetTablePath (), ETableType::Table, showCreate );
143
168
144
169
if (key.GetKeyType () == TKikimrKey::Type::TableScheme) {
145
170
table.RequireStats ();
@@ -238,6 +263,7 @@ class TKiSourceLoadTableMetadataTransformer : public TGraphTransformerBase {
238
263
.WithAuthInfo (table.GetNeedAuthInfo ())
239
264
.WithExternalSourceFactory (ExternalSourceFactory)
240
265
.WithReadAttributes (readAttrs ? std::move (*readAttrs) : THashMap<TString, TString>{})
266
+ .WithShowCreate (table.GetShowCreate ())
241
267
);
242
268
243
269
futures.push_back (future.Apply ([result, queryType]
0 commit comments