Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
advancedxy committed Apr 12, 2024
1 parent 5e593bb commit 318723e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions datafusion/physical-expr/src/expressions/in_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,14 @@ mod tests {
macro_rules! in_list {
($BATCH:expr, $LIST:expr, $NEGATED:expr, $EXPECTED:expr, $COL:expr, $SCHEMA:expr) => {{
let (cast_expr, cast_list_exprs) = in_list_cast($COL, $LIST, $SCHEMA)?;
let expr = in_list(cast_expr, cast_list_exprs, $NEGATED, $SCHEMA).unwrap();
in_list_raw!($BATCH, cast_list_exprs, $NEGATED, $EXPECTED, cast_expr, $SCHEMA);
}};
}

// applies the in_list expr to an input batch and list without cast
macro_rules! in_list_raw {
($BATCH:expr, $LIST:expr, $NEGATED:expr, $EXPECTED:expr, $COL:expr, $SCHEMA:expr) => {{
let expr = in_list($COL, $LIST, $NEGATED, $SCHEMA).unwrap();
let result = expr
.evaluate(&$BATCH)?
.into_array($BATCH.num_rows())
Expand Down Expand Up @@ -1362,7 +1369,7 @@ mod tests {
],
];
for list in lists.iter() {
in_list!(
in_list_raw!(
batch,
list.clone(),
&false,
Expand All @@ -1374,7 +1381,7 @@ mod tests {

// expression: "a not in ("a", "b")"
for list in lists.iter() {
in_list!(
in_list_raw!(
batch,
list.clone(),
&true,
Expand All @@ -1394,7 +1401,7 @@ mod tests {
],
];
for list in lists.iter() {
in_list!(
in_list_raw!(
batch,
list.clone(),
&false,
Expand All @@ -1406,7 +1413,7 @@ mod tests {

// expression: "a not in ("a", "b", null)"
for list in lists.iter() {
in_list!(
in_list_raw!(
batch,
list.clone(),
&true,
Expand Down

0 comments on commit 318723e

Please sign in to comment.