@@ -141,12 +141,13 @@ struct TObjectStorageExternalSource : public IExternalSource {
141
141
if (TString errorString; !NYql::NS3::ValidateWildcards (location, errorString)) {
142
142
issues.AddIssue (MakeErrorIssue (Ydb::StatusIds::BAD_REQUEST, TStringBuilder () << " Location '" << location << " ' contains invalid wildcard: " << errorString));
143
143
}
144
- if (objectStorage.partitioned_by_size () && NYql::NS3::HasWildcards (location)) {
145
- issues.AddIssue (MakeErrorIssue (Ydb::StatusIds::BAD_REQUEST, TStringBuilder () << " Location '" << location << " ' contains wildcards" ));
146
- }
147
- issues.AddIssues (ValidateFormatSetting (objectStorage.format (), objectStorage.format_setting (), location));
144
+ const bool hasPartitioning = objectStorage.projection_size () || objectStorage.partitioned_by_size ();
145
+ issues.AddIssues (ValidateFormatSetting (objectStorage.format (), objectStorage.format_setting (), location, hasPartitioning));
148
146
issues.AddIssues (ValidateRawFormat (objectStorage.format (), schema, objectStorage.partitioned_by ()));
149
- if (objectStorage.projection_size () || objectStorage.partitioned_by_size ()) {
147
+ if (hasPartitioning) {
148
+ if (NYql::NS3::HasWildcards (location)) {
149
+ issues.AddIssue (MakeErrorIssue (Ydb::StatusIds::BAD_REQUEST, TStringBuilder () << " Location '" << location << " ' contains wildcards" ));
150
+ }
150
151
try {
151
152
TVector<TString> partitionedBy{objectStorage.partitioned_by ().begin (), objectStorage.partitioned_by ().end ()};
152
153
issues.AddIssues (ValidateProjectionColumns (schema, partitionedBy));
@@ -166,15 +167,15 @@ struct TObjectStorageExternalSource : public IExternalSource {
166
167
return issues;
167
168
}
168
169
169
- static NYql::TIssues ValidateFormatSetting (const TString& format, const google::protobuf::Map<TString, TString>& formatSetting, const TString& location) {
170
+ static NYql::TIssues ValidateFormatSetting (const TString& format, const google::protobuf::Map<TString, TString>& formatSetting, const TString& location, bool hasPartitioning ) {
170
171
NYql::TIssues issues;
171
172
issues.AddIssues (ValidateDateFormatSetting (formatSetting));
172
173
for (const auto & [key, value]: formatSetting) {
173
174
if (key == " file_pattern" sv) {
174
175
if (TString errorString; !NYql::NS3::ValidateWildcards (value, errorString)) {
175
176
issues.AddIssue (MakeErrorIssue (Ydb::StatusIds::BAD_REQUEST, TStringBuilder () << " File pattern '" << value << " ' contains invalid wildcard: " << errorString));
176
177
}
177
- if (value && !location.EndsWith (" /" )) {
178
+ if (value && !hasPartitioning && ! location.EndsWith (" /" )) {
178
179
issues.AddIssue (MakeErrorIssue (Ydb::StatusIds::BAD_REQUEST, " Path pattern cannot be used with file_pattern" ));
179
180
}
180
181
continue ;
0 commit comments