@@ -849,6 +849,48 @@ class TPrepTableKeys: public ITableKeys {
849
849
return nullptr ;
850
850
}
851
851
return Y (func.EndsWith (" strict" ) ? " MrPartitionListStrict" : " MrPartitionList" , Y (" EvaluateExpr" , arg.Expr ));
852
+ } else if (func == " partitions" || func == " partitionsstrict" ) {
853
+ auto requiredLangVer = MakeLangVersion (2025 , 4 );
854
+ if (!IsBackwardCompatibleFeatureAvailable (ctx.Settings .LangVer , requiredLangVer, ctx.Settings .BackportMode )) {
855
+ auto str = FormatLangVersion (requiredLangVer);
856
+ YQL_ENSURE (str);
857
+ ctx.Error (Pos_) << " PARTITIONS table function is not available before language version " << *str;
858
+ return nullptr ;
859
+ }
860
+
861
+ if (ctx.DiscoveryMode ) {
862
+ ctx.Error (Pos_, TIssuesIds::YQL_NOT_ALLOWED_IN_DISCOVERY) << " PARTITIONS is not allowed in Discovery mode" ;
863
+ return nullptr ;
864
+ }
865
+
866
+ if (Args_.size () != 2 ) {
867
+ ctx.Error (Pos_) << " PARTITIONS requires 2 arguments, but got: " << Args_.size ();
868
+ return nullptr ;
869
+ }
870
+
871
+ if (Args_[0 ].HasAt || Args_[1 ].HasAt ) {
872
+ ctx.Error (Pos_) << " Temporary tables are not supported here" ;
873
+ return nullptr ;
874
+ }
875
+
876
+ if (!Args_[1 ].View .empty ()) {
877
+ ctx.Error (Pos_) << " VIEW should be used only in first argument" ;
878
+ return nullptr ;
879
+ }
880
+
881
+ ExtractTableName (ctx, Args_[0 ]);
882
+ ExtractTableName (ctx, Args_[1 ]);
883
+ auto path = ctx.GetPrefixedPath (Service_, Cluster_, Args_[0 ].Id );
884
+ if (!path) {
885
+ return nullptr ;
886
+ }
887
+ TNodePtr key = Y (" Key" , Q (Y (Q (" table" ), Y (" String" , path))));
888
+ key = AddView (key, Args_[0 ].View );
889
+ if (!ValidateView (GetPos (), ctx, Service_, Args_[0 ].View )) {
890
+ return nullptr ;
891
+ }
892
+ TDeferredAtom pattern = Args_[1 ].Id ;
893
+ return Y (func.EndsWith (" strict" ) ? " MrPartitionsStrict" : " MrPartitions" , key, pattern.Build ());
852
894
}
853
895
854
896
ctx.Error (Pos_) << " Unknown table name preprocessor: " << Func_;
0 commit comments