noob-se7en commented on code in PR #18454:
URL: https://github.com/apache/pinot/pull/18454#discussion_r3387118860
##########
pinot-plugins/pinot-file-system/pinot-adls/src/main/java/org/apache/pinot/plugin/filesystem/ADLSGen2PinotFS.java:
##########
@@ -651,7 +659,17 @@ public boolean touch(URI uri)
try {
DataLakeFileClient fileClient =
_fileSystemClient.getFileClient(AzurePinotFSUtil.convertUriToAzureStylePath(uri));
- PathProperties pathProperties = fileClient.getProperties();
+ PathProperties pathProperties;
+ try {
+ pathProperties = fileClient.getProperties();
+ } catch (DataLakeStorageException e) {
+ if (e.getStatusCode() == NOT_FOUND_STATUS_CODE) {
+ // File does not exist — create an empty file to satisfy the PinotFS
touch() contract
+
_fileSystemClient.createFile(AzurePinotFSUtil.convertUriToAzureStylePath(uri));
Review Comment:
none of the seven new branches here has a unit test, and
`ADLSGen2PinotFSTest` already stubs 404s elsewhere (`testExistsFalse`), so
these are cheap to add. the live ones: `open()` and `copySrcToDst()`
404→`FileNotFoundException`, `lastModified()` 404→`0L` and null→`0L`,
`isDirectory()` null-metadata→false, and the two `listFilesWithMetadata`
null-`getLastModified` guards. this `touch()` create-on-404 path is the
headline change, but the only production caller
(`SegmentDeletionManager.moveSegmentsToDeletedDir`) touches a file it just
moved into place so it always exists, meaning a unit test is the only thing
that will ever exercise this branch. worth adding cases that stub a 404
`DataLakeStorageException` and null metadata/timestamps so each branch is
covered.
--
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]