You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "rionmonster (via GitHub)" <gi...@apache.org> on 2026/02/07 18:06:51 UTC

[PR] Flink 38936 [flink]

rionmonster opened a new pull request, #27553:
URL: https://github.com/apache/flink/pull/27553

   ## What is the purpose of the change
   
   This pull request addresses the issue detailed in [FLINK-38936](https://issues.apache.org/jira/browse/FLINK-38783) which demonstrates a Windows-specific bug related to file name resolution within the FileSystem SQL Connector
   
   ## Brief change log
   
   todo
   
   ## Verifying this change
   
   todo
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): **no**
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: **no**
     - The serializers: **no**
     - The runtime per-record code paths (performance sensitive): **no**
     - Anything that affects deployment or recovery: **no/don't know**
     - The S3 file system connector: **no**
   
   ## Documentation
   
     - Does this pull request introduce a new feature? **no**
     - If yes, how is the feature documented? **not applicable**


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4099859880

   @flinkbot run azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on code in PR #27553:
URL: https://github.com/apache/flink/pull/27553#discussion_r2788101349


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/connector/file/table/FileSystemTableSourceTest.java:
##########
@@ -80,4 +90,35 @@ void testMetadataReading() {
         util.verifyRelPlanInsert(
                 "insert into MySink(a, b, c) select a, b, filemeta from MyTableWithMeta");
     }
+
+    @ParameterizedTest(name = "extractFileName({0}) -> {1}")
+    @MethodSource("fileNameCases")
+    void testFileNameExtraction(String rawPath, String expected) {
+        String extractedFileName = FileSystemTableSource.extractFileName(new Path(rawPath));
+        assertThat(extractedFileName).isEqualTo(expected);
+    }
+
+    @ParameterizedTest(name = "file.name accessor for {0}")
+    @MethodSource("fileNameCases")
+    void testFileNameMetadataAccessor(String rawPath, String expected) {
+        FileSourceSplit split =
+                new FileSourceSplit("test-split", new Path(rawPath), 0L, 1L, 0L, 1L);
+
+        Object actual =
+                FileSystemTableSource.ReadableFileInfo.FILENAME.getAccessor().getValue(split);
+
+        assertThat(actual).isEqualTo(StringData.fromString(expected));
+    }
+
+    static Stream<Arguments> fileNameCases() {
+        return Stream.of(
+                Arguments.of("file:/D:/AI-Book/FlinkApplication/data/input/user.csv", "user.csv"),
+                Arguments.of("file:/D:/tmp/input/test.csv", "test.csv"),
+                Arguments.of("file:/C:/Users/me/Desktop/thing.txt", "thing.txt"),
+                Arguments.of("file:///tmp/input/user.csv", "user.csv"),
+                Arguments.of("file:/tmp/input/dir/", "dir"),
+                Arguments.of("file://localhost/tmp/input/user.csv", "user.csv"),
+                Arguments.of("s3://bucket/a/b/c.parquet", "c.parquet"),
+                Arguments.of("/tmp/input/dir/file.txt", "file.txt"));

Review Comment:
   Good catch — I've gone ahead and added quite a few more exhaustive, edge-cases like these. Thanks!



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4099767480

   @rionmonster thanks for the contribution 
   looks reasonable
   it looks like spotless still needs to be addressed, can you do that please?


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on code in PR #27553:
URL: https://github.com/apache/flink/pull/27553#discussion_r2787994869


##########
flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/FileSystemTableSource.java:
##########


Review Comment:
   I don't believe that the `file.path` accessor specifically needs to be changed (as it still relies on the correct Flink-based Path class instead of the problematic `java.nio.file.Paths` variant). I'll go ahead and add a series of tests cases while I'm in here to triply confirm it isn't affected by the same bug.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4101783200

   @snuyanzin 
   
   Rebasing addressed the issue — CI looks good now!


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-3879055947

   @flinkbot run azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4100899658

   @rionmonster based on the failure it fails on errors which was fixed already
   
   can you just rebase the PR to the most recent master's commit
   I incline it should help


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on code in PR #27553:
URL: https://github.com/apache/flink/pull/27553#discussion_r2788577699


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/connector/file/table/FileSystemTableSourceTest.java:
##########
@@ -80,4 +89,93 @@ void testMetadataReading() {
         util.verifyRelPlanInsert(
                 "insert into MySink(a, b, c) select a, b, filemeta from MyTableWithMeta");
     }
+
+    @ParameterizedTest(name = "extractFileName({0}) -> {1}")
+    @MethodSource("fileNameCases")
+    void testFileNameExtraction(String rawPath, String expected) {
+        String extractedFileName = FileSystemTableSource.extractFileName(new Path(rawPath));
+        assertThat(extractedFileName).isEqualTo(expected);
+    }
+
+    @ParameterizedTest(name = "file.name accessor for {0}")
+    @MethodSource("fileNameCases")
+    void testFileNameMetadataAccessor(String rawPath, String expected) {

Review Comment:
   Makes sense! I've gone ahead and converted this to a `testMetadataAccessor` that accepts the info as one of the parameters and created a wrapper around the previous separate test cases (e.g., `fileNameCases()` and `filePathCases()`) to associate those with the appropriate types.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4102847689

   great, thanks for addressing it


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "rionmonster (via GitHub)" <gi...@apache.org>.
rionmonster commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-4099841464

   @snuyanzin 
   
   Done! Not quite sure how it was missed initially, but should be good now. 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #27553:
URL: https://github.com/apache/flink/pull/27553#discussion_r2788422193


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/connector/file/table/FileSystemTableSourceTest.java:
##########
@@ -80,4 +89,93 @@ void testMetadataReading() {
         util.verifyRelPlanInsert(
                 "insert into MySink(a, b, c) select a, b, filemeta from MyTableWithMeta");
     }
+
+    @ParameterizedTest(name = "extractFileName({0}) -> {1}")
+    @MethodSource("fileNameCases")
+    void testFileNameExtraction(String rawPath, String expected) {
+        String extractedFileName = FileSystemTableSource.extractFileName(new Path(rawPath));
+        assertThat(extractedFileName).isEqualTo(expected);
+    }
+
+    @ParameterizedTest(name = "file.name accessor for {0}")
+    @MethodSource("fileNameCases")
+    void testFileNameMetadataAccessor(String rawPath, String expected) {

Review Comment:
   nit: as the test method for path and filename are the same apart from one word, could we make this one parameterized test method?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #27553:
URL: https://github.com/apache/flink/pull/27553


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Flink 38936 [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #27553:
URL: https://github.com/apache/flink/pull/27553#issuecomment-3865027631

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9ecebad41b3d8f92335a0be0bfdb29efc4f62584",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9ecebad41b3d8f92335a0be0bfdb29efc4f62584",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9ecebad41b3d8f92335a0be0bfdb29efc4f62584 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-38936][connectors/filesystem] Improve OS-Independent File Path Resolution for FileSystem Connector [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #27553:
URL: https://github.com/apache/flink/pull/27553#discussion_r2787741902


##########
flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/FileSystemTableSource.java:
##########


Review Comment:
   does this need to be changed as well? If not it might be worth adding tests for it anyway



##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/connector/file/table/FileSystemTableSourceTest.java:
##########
@@ -80,4 +90,35 @@ void testMetadataReading() {
         util.verifyRelPlanInsert(
                 "insert into MySink(a, b, c) select a, b, filemeta from MyTableWithMeta");
     }
+
+    @ParameterizedTest(name = "extractFileName({0}) -> {1}")
+    @MethodSource("fileNameCases")
+    void testFileNameExtraction(String rawPath, String expected) {
+        String extractedFileName = FileSystemTableSource.extractFileName(new Path(rawPath));
+        assertThat(extractedFileName).isEqualTo(expected);
+    }
+
+    @ParameterizedTest(name = "file.name accessor for {0}")
+    @MethodSource("fileNameCases")
+    void testFileNameMetadataAccessor(String rawPath, String expected) {
+        FileSourceSplit split =
+                new FileSourceSplit("test-split", new Path(rawPath), 0L, 1L, 0L, 1L);
+
+        Object actual =
+                FileSystemTableSource.ReadableFileInfo.FILENAME.getAccessor().getValue(split);
+
+        assertThat(actual).isEqualTo(StringData.fromString(expected));
+    }
+
+    static Stream<Arguments> fileNameCases() {
+        return Stream.of(
+                Arguments.of("file:/D:/AI-Book/FlinkApplication/data/input/user.csv", "user.csv"),
+                Arguments.of("file:/D:/tmp/input/test.csv", "test.csv"),
+                Arguments.of("file:/C:/Users/me/Desktop/thing.txt", "thing.txt"),
+                Arguments.of("file:///tmp/input/user.csv", "user.csv"),
+                Arguments.of("file:/tmp/input/dir/", "dir"),
+                Arguments.of("file://localhost/tmp/input/user.csv", "user.csv"),
+                Arguments.of("s3://bucket/a/b/c.parquet", "c.parquet"),
+                Arguments.of("/tmp/input/dir/file.txt", "file.txt"));

Review Comment:
   other tests could include
   - tmp/input/dir/file.txt
   -../ type paths if they are supported
   - filenames with escaped characters in like quotes and dots. 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org