jayzhan211 commented on code in PR #9710:
URL: https://github.com/apache/arrow-datafusion/pull/9710#discussion_r1533168276
##########
datafusion/functions-array/src/set_ops.rs:
##########
@@ -273,55 +284,97 @@ fn generic_set_lists<OffsetSize: OffsetSizeTrait>(
let mut offsets = vec![OffsetSize::usize_as(0)];
let mut new_arrays = vec![];
+ let mut nulls = vec![];
let converter = RowConverter::new(vec![SortField::new(dt)])?;
for (first_arr, second_arr) in l.iter().zip(r.iter()) {
- if let (Some(first_arr), Some(second_arr)) = (first_arr, second_arr) {
- let l_values = converter.convert_columns(&[first_arr])?;
- let r_values = converter.convert_columns(&[second_arr])?;
-
- let l_iter = l_values.iter().sorted().dedup();
- let values_set: HashSet<_> = l_iter.clone().collect();
- let mut rows = if set_op == SetOp::Union {
- l_iter.collect::<Vec<_>>()
- } else {
- vec![]
- };
- for r_val in r_values.iter().sorted().dedup() {
- match set_op {
- SetOp::Union => {
- if !values_set.contains(&r_val) {
- rows.push(r_val);
+ let last_offset = match offsets.last().copied() {
+ Some(offset) => offset,
+ None => return internal_err!("offsets should not be empty"),
+ };
+ match (first_arr, second_arr) {
+ (Some(first_arr), Some(second_arr)) => {
+ let mut l_values = converter.convert_columns(&[first_arr])?;
+ let mut r_values = converter.convert_columns(&[second_arr])?;
+
+ if set_op == SetOp::Except {
+ (l_values, r_values) = (r_values, l_values);
Review Comment:
I think mixing the logic of except here make it less readable 😕
--
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]