Skip to content

Commit 160d6c8

Browse files
committed
refactor the by comment
1 parent 63eabac commit 160d6c8

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

src/query/service/src/interpreters/interpreter_copy_v2.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,26 @@ impl CopyInterpreterV2 {
8787
let stage_file = &stage_file[0];
8888

8989
if let Some(file_info) = resp.file_info.get(file) {
90-
// No need to copy the file again if etag is_some and match.
91-
if stage_file.etag.is_some() && stage_file.etag == file_info.etag {
92-
tracing::warn!("ignore copy file {:?} matched by etag", file);
93-
continue;
94-
}
95-
96-
if file_info.content_length == stage_file.size
97-
&& file_info.last_modified == Some(stage_file.last_modified)
98-
{
99-
tracing::warn!(
100-
"ignore copy file {:?} matched by content_length and last_modified",
101-
file
102-
);
103-
continue;
90+
match &file_info.etag {
91+
Some(_etag) => {
92+
// No need to copy the file again if etag is_some and match.
93+
if stage_file.etag == file_info.etag {
94+
tracing::warn!("ignore copy file {:?} matched by etag", file);
95+
continue;
96+
}
97+
}
98+
None => {
99+
// etag is none, compare with content_length and last_modified.
100+
if file_info.content_length == stage_file.size
101+
&& file_info.last_modified == Some(stage_file.last_modified)
102+
{
103+
tracing::warn!(
104+
"ignore copy file {:?} matched by content_length and last_modified",
105+
file
106+
);
107+
continue;
108+
}
109+
}
104110
}
105111
}
106112

0 commit comments

Comments
 (0)