hello-stephen commented on code in PR #71198:
URL: https://github.com/apache/doris/pull/71198#discussion_r4749168997
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/tvf/source/TVFScanNode.java:
##########
@@ -192,6 +195,32 @@ public List<Split> getSplits(int numBackends) throws
UserException {
return splits;
}
+ private boolean isFormatSplittable() {
+ TFileFormatType format = tableValuedFunction.getTFileFormatType();
+ if (format == TFileFormatType.FORMAT_JSON) {
+ // Document mode parses each range as a complete JSON value,
including implicit array mode.
+ return getFileAttributes().isReadJsonByLine();
+ }
+ if (Util.isCsvFormat(format) || format == TFileFormatType.FORMAT_TEXT)
{
+ TFileAttributes attributes = getFileAttributes();
+ if (Util.isCsvFormat(format) &&
attributes.getTextParams().getEnclose() != 0) {
+ // A byte boundary may lie inside a quoted multiline field;
ranges cannot recover quote state.
+ return false;
+ }
+ int skippedLines = attributes.getSkipLines();
+ // Header modes override skip_lines in the reader.
+ if
(FileFormatProperties.FORMAT_CSV_WITH_NAMES.equalsIgnoreCase(attributes.getHeaderType()))
{
+ skippedLines = 1;
+ } else if (FileFormatProperties.FORMAT_CSV_WITH_NAMES_AND_TYPES
+ .equalsIgnoreCase(attributes.getHeaderType())) {
+ skippedLines = 2;
+ }
+ // Non-first ranges skip one partial record, but cannot consume a
remaining multi-record prefix.
+ return skippedLines <= 1;
Review Comment:
[P2] Preserve Hive text delimiter alignment before enabling these splits
This also permits `hive_text` with an overlapping multi-byte delimiter,
although both text readers still back up one delimiter length and skip just one
record. For example, set `file_split_size=1024` and read an uncompressed
`input.gz` with `format=hive_text`, `compress_type=PLAIN`, `line_delimiter=||`,
and `csv_schema=value:string`. If its bytes are `("a" * 1021) + "|||||" + ("b"
* 200) + "||"`, a full-row query previously used one range and returned three
records: the a-string, an empty string, and the b-string prefixed by `|`. This
change creates 1024/204-byte ranges. The second range starts parsing at offset
1022, skips pipes 1022–1023, then emits another empty record at 1024–1025 and
the b-string without its leading pipe: four rows with altered data.
Unlike CSV/JSON, neither `be/src/format/text/text_reader.cpp` nor
`be/src/format_v2/delimited_text/text_reader.cpp` uses the overlap-aware
`skip_split_prefix` helper. Apply that alignment to Hive text in both scanners,
or keep affected delimiters unsplittable, and cover this boundary in the
regression.
--
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]