@@ -261,11 +261,32 @@ std::pair<DB::ObjectStoragePtr, std::string> resolveObjectStorageForPath(
261261{
262262 if (isRelativePath (path))
263263 {
264+ // For relative paths, we need to construct the "full" key: table location + relative path
265+ std::string full_key = path;
266+
267+ if (!table_location.empty ())
268+ {
269+ SchemeAuthorityKey base{table_location};
270+ if (!base.key .empty ())
271+ {
272+ // Combine base key with relative path
273+ full_key = base.key ;
274+ if (!full_key.empty () && full_key.back () != ' /' )
275+ full_key += ' /' ;
276+
277+ std::string rel_path = path;
278+ if (!rel_path.empty () && rel_path.front () == ' /' )
279+ rel_path = rel_path.substr (1 );
280+
281+ full_key += rel_path;
282+ }
283+ }
284+
264285 if (base_storage)
265- std::cerr << " \n Relative path: " << base_storage->getName () << " , " << base_storage->getObjectsNamespace () << " \n " ;
286+ std::cerr << " \n Relative path: " << base_storage->getName () << " , " << base_storage->getObjectsNamespace () << " . full_key: " << full_key << " \n " ;
266287 else
267288 std::cerr << " \n Relative, returning base, which is: NULL\n " ;
268- return {base_storage, path }; // Relative path definitely goes to base storage
289+ return {base_storage, full_key }; // Relative path definitely goes to base storage
269290 }
270291
271292 SchemeAuthorityKey base{table_location};
@@ -298,6 +319,7 @@ std::pair<DB::ObjectStoragePtr, std::string> resolveObjectStorageForPath(
298319
299320 if (s3_uri.bucket == base_s3_uri.bucket && s3_uri.endpoint == base_s3_uri.endpoint )
300321 {
322+ std::cerr << " \n Path: " << path << " \n " ;
301323 if (base_storage)
302324 std::cerr << " \n Same S3 location, returning base, which is: " << base_storage->getName () << " , " << base_storage->getObjectsNamespace () << " \n " ;
303325 else
0 commit comments