@@ -122,7 +122,7 @@ std::string DeltaUuidUtils::encodeBytesToBase85(std::string_view data) {
122122}
123123
124124DeltaUuidUtils::Uuid DeltaUuidUtils::decodeZ85ToUuid (const std::string& z85) {
125- VELOX_CHECK_EQ (z85.length (), 20 , " Z85 encoded UUID must be exactly 20 characters" );
125+ VELOX_USER_CHECK_EQ (z85.length (), 20 , " Z85 encoded UUID must be exactly 20 characters" );
126126
127127 Uuid uuid;
128128
@@ -136,11 +136,11 @@ DeltaUuidUtils::Uuid DeltaUuidUtils::decodeZ85ToUuid(const std::string& z85) {
136136
137137std::string DeltaUuidUtils::decodeBase85ToBytes (std::string_view encoded, size_t decodedSize) {
138138 if (encoded.empty ()) {
139- VELOX_CHECK_EQ (decodedSize, 0 , " Expected decoded Base85 size to be 0 for empty input" );
139+ VELOX_USER_CHECK_EQ (decodedSize, 0 , " Expected decoded Base85 size to be 0 for empty input" );
140140 return " " ;
141141 }
142142
143- VELOX_CHECK_EQ (encoded.size () % 5 , 0 , " Base85 encoded payload must be aligned to 5-character blocks" );
143+ VELOX_USER_CHECK_EQ (encoded.size () % 5 , 0 , " Base85 encoded payload must be aligned to 5-character blocks" );
144144
145145 const size_t maxDecodedSize = (encoded.size () / 5 ) * 4 ;
146146 VELOX_CHECK_LE (
@@ -201,7 +201,7 @@ std::pair<std::string, DeltaUuidUtils::Uuid> DeltaUuidUtils::extractUuidFromZ85(
201201 // Z85-encoded UUID is always 20 characters
202202 // Any characters before that are the random prefix
203203 if (z85.length () < 20 ) {
204- VELOX_FAIL (" Z85 string too short to contain UUID: {}" , z85);
204+ VELOX_USER_FAIL (" Z85 string too short to contain UUID: {}" , z85);
205205 }
206206
207207 std::string randomPrefix;
@@ -223,13 +223,22 @@ std::pair<std::string, DeltaUuidUtils::Uuid> DeltaUuidUtils::extractUuidFromZ85(
223223std::string
224224DeltaUuidUtils::reconstructUuidPath (const std::string& tableDir, const std::string& randomPrefix, const Uuid& uuid) {
225225 std::ostringstream oss;
226- oss << tableDir;
226+ const auto normalizedTableDir =
227+ !tableDir.empty () && tableDir.back () == ' /' ? tableDir.substr (0 , tableDir.size () - 1 ) : tableDir;
228+ oss << normalizedTableDir;
227229
228230 if (!randomPrefix.empty ()) {
229- oss << " /" << randomPrefix;
231+ if (!normalizedTableDir.empty ()) {
232+ oss << " /" ;
233+ }
234+ oss << randomPrefix;
235+ }
236+
237+ if (!normalizedTableDir.empty () || !randomPrefix.empty ()) {
238+ oss << " /" ;
230239 }
231240
232- oss << " / deletion_vector_" << uuidToString (uuid) << " .bin" ;
241+ oss << " deletion_vector_" << uuidToString (uuid) << " .bin" ;
233242 return oss.str ();
234243}
235244
0 commit comments