|
9 | 9 |
|
10 | 10 | #include <yql/essentials/core/yql_expr_optimize.h> |
11 | 11 | #include <yql/essentials/core/yql_expr_type_annotation.h> |
| 12 | +#include <yql/essentials/core/yql_opt_utils.h> |
12 | 13 | #include <yql/essentials/providers/common/schema/expr/yql_expr_schema.h> |
13 | 14 | #include <ydb/library/yql/providers/dq/expr_nodes/dqs_expr_nodes.h> |
14 | 15 | #include <ydb/library/yql/dq/expr_nodes/dq_expr_nodes.h> |
@@ -95,6 +96,15 @@ namespace { |
95 | 96 | using namespace NKikimr; |
96 | 97 | using namespace NNodes; |
97 | 98 |
|
| 99 | +bool IsShowCreate(const TExprNode& read) { |
| 100 | + if (read.ChildrenSize() <= TKiReadTable::idx_Settings) { |
| 101 | + return false; |
| 102 | + } |
| 103 | + const auto& settings = *read.Child(TKiReadTable::idx_Settings); |
| 104 | + return HasSetting(settings, "showCreateTable") |
| 105 | + || HasSetting(settings, "showCreateView"); |
| 106 | +} |
| 107 | + |
98 | 108 | class TKiSourceIntentDeterminationTransformer: public TKiSourceVisitorTransformer { |
99 | 109 | public: |
100 | 110 | TKiSourceIntentDeterminationTransformer(TIntrusivePtr<TKikimrSessionContext> sessionCtx) |
@@ -795,7 +805,7 @@ class TKikimrDataSource : public TDataProviderBase { |
795 | 805 | retChildren[0] = newRead; |
796 | 806 | return ctx.ChangeChildren(*node, std::move(retChildren)); |
797 | 807 | } |
798 | | - } else if (tableDesc.Metadata->Kind == EKikimrTableKind::View) { |
| 808 | + } else if (tableDesc.Metadata->Kind == EKikimrTableKind::View && !IsShowCreate(*read)) { |
799 | 809 | if (!SessionCtx->Config().FeatureFlags.GetEnableViews()) { |
800 | 810 | ctx.AddError(TIssue(node->Pos(ctx), |
801 | 811 | "Views are disabled. Please contact your system administrator to enable the feature")); |
|
0 commit comments