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


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/split/FileSplitter.java:
##########
@@ -111,7 +126,11 @@ public List<Split> splitFile(
             blockLocations[0] = new FileBlockLocation(null, 0L, length);
         }
         List<Split> result = Lists.newArrayList();
-        TFileCompressType compressType = 
Util.inferFileCompressTypeByPath(path.getNormalizedLocation());
+        // Match schema inference and BE ranges: explicit GZ may have no 
suffix, and PLAIN may end in .gz.
+        // Parquet/ORC leave the envelope codec unset because their 
compression is internal to the file.
+        TFileCompressType compressType = Util.getOrInferCompressType(
+                configuredCompression == null ? TFileCompressType.UNKNOWN : 
configuredCompression,

Review Comment:
   [P1] Preserve enclosed CSV records before enabling PLAIN splits
   
   A plaintext `.gz` file read with `compress_type=PLAIN` and `enclose` can 
contain quoted fields spanning newlines. This change newly splits it by bytes, 
but non-first ranges create a fresh `EncloseCsvLineReaderCtx` and skip only one 
apparent line, losing the quote state. For example, with a 1024-byte split and 
`csv_schema=id:int;payload:string`, the valid file `0,"<1100 a 
bytes>\n1,phantom\n2,tail"\n3,real\n` has only IDs 0 and 3; the second split 
starts inside the quoted payload and additionally returns IDs 1 and 2. 
Previously the suffix kept this file whole. Preserve whole-file ranges for 
enclosed CSV until quote-aware boundaries are available, and cover this case 
with a full-row regression.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/tvf/source/TVFScanNode.java:
##########
@@ -161,6 +161,7 @@ public List<Split> getSplits(int numBackends) throws 
UserException {
                         fileStatus.getSize(),
                         fileStatus.getModificationTime(),
                         fileStatus.isSplitable && needSplit,
+                        tableValuedFunction.getTFileCompressType(),

Review Comment:
   [P2] Keep whole-document JSON unsplittable with an explicit codec
   
   Passing `PLAIN` here newly makes a plaintext `input.gz` splittable, 
including JSON with `read_json_by_line=false` (also selected by 
`strip_outer_array=true` without an explicit line-mode setting). With 
`file_split_size=1024` and a multi-kilobyte JSON array, discovery marks the 
file splittable and this now emits byte ranges. 
`JsonReader::_read_one_document()` treats each range as an entire document, so 
a SELECT that previously read the whole file now fails on truncated JSON. Keep 
whole-document JSON unsplittable independently of the effective codec and add 
this mode to the regression cases; the new JSON cases all force line mode.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/split/FileSplitter.java:
##########
@@ -111,7 +126,11 @@ public List<Split> splitFile(
             blockLocations[0] = new FileBlockLocation(null, 0L, length);
         }
         List<Split> result = Lists.newArrayList();
-        TFileCompressType compressType = 
Util.inferFileCompressTypeByPath(path.getNormalizedLocation());
+        // Match schema inference and BE ranges: explicit GZ may have no 
suffix, and PLAIN may end in .gz.
+        // Parquet/ORC leave the envelope codec unset because their 
compression is internal to the file.
+        TFileCompressType compressType = Util.getOrInferCompressType(

Review Comment:
   [P2] Preserve skip_lines across the newly enabled byte ranges
   
   With `compress_type=PLAIN`, a plaintext `input.gz` can now expose lines that 
`skip_lines` should discard. For example, use `file_split_size=1024`, 
`skip_lines=20`, `csv_schema=id:int;payload:string`, twenty valid 64-byte 
preamble lines, then a data row. The first range skips 16 lines and reaches its 
byte limit with four skips unused. Non-first ranges only align past their 
partial first line and reset `_skip_lines` to zero, so the second range returns 
the remaining four preamble lines as data. Previously the suffix forced a 
whole-file range and all 20 lines were skipped. Keep the entire configured 
preamble excluded from subsequent ranges and add a regression with the skipped 
prefix extending beyond the first split.



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