Vamsi-klu commented on code in PR #19085:
URL: https://github.com/apache/pinot/pull/19085#discussion_r3746565070
##########
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:
Reverted in `82d01e9`. The original inline logic is back, so the table name
from segment metadata is only read in the fallback path when the request
parameter is absent, which keeps table name decoupled from metadata like you
wanted.
I also dropped the `resolveRawTableNameForUpload` helper and the unit test
that called it, so what is left is just the endpoint `ApiParam` wording and the
`-tableName` description in `UploadSegmentCommand`. The PR is doc-only now, no
behavior change.
--
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]