Jackie-Jiang commented on code in PR #19085:
URL: https://github.com/apache/pinot/pull/19085#discussion_r3669342284
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -1313,6 +1311,38 @@ private FileUploadType getUploadType(String
uploadTypeStr) {
}
}
+ /**
+ * Resolve the raw table name for a segment upload.
+ * <p>
+ * The request {@code tableName} query parameter (also set by admin {@code
-tableName} and batch
+ * {@code tableSpec.tableName}) is authoritative. Segment metadata {@code
segment.table.name} is only
+ * used when the request omits the parameter. Callers may therefore build a
segment for table A and
+ * upload it to table B without rewriting the tar.
+ *
+ * @param requestTableName table name from the upload request (may be
null/empty or typed)
+ * @param segmentMetadata metadata read from the uploaded segment
+ * @return raw (untyped) table name used for ZK / deep-store routing
+ */
+ @VisibleForTesting
+ static String resolveRawTableNameForUpload(@Nullable String
requestTableName, SegmentMetadata segmentMetadata) {
+ String metadataTableName = segmentMetadata.getTableName();
+ if (StringUtils.isNotEmpty(requestTableName)) {
+ String rawTableName =
TableNameBuilder.extractRawTableName(requestTableName);
+ if (StringUtils.isNotEmpty(metadataTableName)) {
+ String metadataRawTableName =
TableNameBuilder.extractRawTableName(metadataTableName);
+ if (!rawTableName.equals(metadataRawTableName)) {
Review Comment:
Suggest keeping the original logic. The goal is to decouple table name from
segment metadata
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]