Skip to content

Commit

Permalink
fix: multiple entries of term after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ansrivas committed May 5, 2024
1 parent c1a43a7 commit 776b836
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/service/search/datafusion/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ pub async fn merge_parquet_files(
let query_sql = if stream_type == StreamType::Index {
// TODO: NOT IN is not efficient, need to optimize it: NOT EXIST
format!(
"SELECT * FROM tbl WHERE file_name NOT IN (SELECT file_name FROM tbl WHERE deleted is True) ORDER BY {} DESC",
"SELECT term, file_name, min(_timestamp) as _timestamp, sum(_count) as _count, deleted FROM tbl WHERE file_name NOT IN (SELECT file_name FROM tbl WHERE deleted is True) GROUP BY term, file_name, deleted ORDER BY {} DESC",
CONFIG.common.column_timestamp
)
} else if CONFIG.limit.distinct_values_hourly
Expand Down

0 comments on commit 776b836

Please sign in to comment.