github-actions[bot] commented on code in PR #69186:
URL: https://github.com/apache/doris/pull/69186#discussion_r4292633348


##########
fe/fe-core/src/main/java/org/apache/doris/planner/TVFTableSink.java:
##########
@@ -155,6 +160,22 @@ public void bindDataSink() throws AnalysisException {
             tSink.setMaxFileSizeBytes(Long.parseLong(maxFileSizeStr));
         }
 
+        // Zero-pad the per-file index in output file names so they sort 
lexicographically.
+        String fileNamePaddingStr = properties.get("file_name_padding");
+        if (fileNamePaddingStr != null) {
+            int fileNamePadding;
+            try {
+                fileNamePadding = Integer.parseInt(fileNamePaddingStr);
+            } catch (NumberFormatException e) {
+                throw new AnalysisException("file_name_padding must be an 
integer. Given: " + fileNamePaddingStr);
+            }
+            if (fileNamePadding < 0 || fileNamePadding > 
MAX_FILE_NAME_PADDING) {
+                throw new AnalysisException("file_name_padding must be between 
0 and "
+                        + MAX_FILE_NAME_PADDING + ". Given: " + 
fileNamePadding);
+            }
+            tSink.setFileNamePadding(fileNamePadding);

Review Comment:
   [P2] Reject unsupported padding for JNI TVF writers
   
   A positive width is accepted together with `writer_class`, but the bundled 
`org/apache/doris/writer/LocalFileJniWriter` cannot apply it. For example, 
`INSERT INTO local("file_path"="/tmp/padded_", "backend_id"="<BE id>", 
"format"="csv", "writer_class"="org/apache/doris/writer/LocalFileJniWriter", 
"file_name_padding"="5") SELECT 7 AS id` still writes `/tmp/padded_`: 
`VTVFTableWriter::_create_file_writer` discards the generated padded filename 
on the JNI branch, the transformer factory passes the original 
`tvf_sink.file_path`, and the Java writer opens that path verbatim. Please 
reject positive padding for unsupported JNI writers, or propagate the generated 
name and implement it there. The new regression only exercises native writers, 
so it misses this silently ignored option.



-- 
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]

Reply via email to