Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement][Cherry-Pick][Branch-2.5] skip text file desc part when file is not text format #33066

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.starrocks.sql.common.ErrorType;
import com.starrocks.sql.common.StarRocksPlannerException;
import com.starrocks.sql.plan.HDFSScanNodePredicates;
import com.starrocks.thrift.THdfsFileFormat;
import com.starrocks.thrift.THdfsScanRange;
import com.starrocks.thrift.TNetworkAddress;
import com.starrocks.thrift.TScanRange;
Expand Down Expand Up @@ -93,7 +94,9 @@ private void createScanRangeLocationsForSplit(long partitionId, RemoteFileInfo p
hdfsScanRange.setFile_length(fileDesc.getLength());
hdfsScanRange.setModification_time(fileDesc.getModificationTime());
hdfsScanRange.setFile_format(partition.getFormat().toThrift());
hdfsScanRange.setText_file_desc(fileDesc.getTextFileFormatDesc().toThrift());
if (isTextFormat(hdfsScanRange.getFile_format())) {
hdfsScanRange.setText_file_desc(fileDesc.getTextFileFormatDesc().toThrift());
}
TScanRange scanRange = new TScanRange();
scanRange.setHdfs_scan_range(hdfsScanRange);
scanRangeLocations.setScan_range(scanRange);
Expand All @@ -113,6 +116,10 @@ private void createScanRangeLocationsForSplit(long partitionId, RemoteFileInfo p
result.add(scanRangeLocations);
}

private boolean isTextFormat(THdfsFileFormat format) {
return format == THdfsFileFormat.TEXT || format == THdfsFileFormat.LZO_TEXT;
}

private void createHudiScanRangeLocations(long partitionId,
RemoteFileInfo partition,
RemoteFileDesc fileDesc,
Expand All @@ -126,7 +133,9 @@ private void createHudiScanRangeLocations(long partitionId,
hdfsScanRange.setPartition_id(partitionId);
hdfsScanRange.setFile_length(fileDesc.getLength());
hdfsScanRange.setFile_format(partition.getFormat().toThrift());
hdfsScanRange.setText_file_desc(fileDesc.getTextFileFormatDesc().toThrift());
if (isTextFormat(hdfsScanRange.getFile_format())) {
hdfsScanRange.setText_file_desc(fileDesc.getTextFileFormatDesc().toThrift());
}
for (String log : fileDesc.getHudiDeltaLogs()) {
hdfsScanRange.addToHudi_logs(log);
}
Expand Down
Loading