(schema: &ArraySchema, query_condition: &ASTNode)
| 397 | } |
| 398 | |
| 399 | fn to_datafusion_impl(schema: &ArraySchema, query_condition: &ASTNode) -> Result<Expr, Error> { |
| 400 | if query_condition.is_expr() { |
| 401 | match *query_condition.get_combination_op() { |
| 402 | QueryConditionCombinationOp::AND => { |
| 403 | combination_ast_to_binary_expr(schema, query_condition, Operator::And) |
| 404 | } |
| 405 | QueryConditionCombinationOp::OR => { |
| 406 | combination_ast_to_binary_expr(schema, query_condition, Operator::Or) |
| 407 | } |
| 408 | QueryConditionCombinationOp::NOT => { |
| 409 | let children = query_condition.children().collect::<Vec<_>>(); |
| 410 | if children.len() != 1 { |
| 411 | return Err(InternalError::NotTree(children.len()).into()); |
| 412 | } |
| 413 | let negate_arg = to_datafusion_impl(schema, children[0])?; |
| 414 | Ok(!negate_arg) |
| 415 | } |
| 416 | invalid => Err(InternalError::InvalidCombinationOp(invalid.repr.into()).into()), |
| 417 | } |
| 418 | } else if query_condition.is_null_test() { |
| 419 | leaf_ast_to_null_test(schema, query_condition) |
| 420 | } else { |
| 421 | match *query_condition.get_op() { |
| 422 | QueryConditionOp::LT => Ok(leaf_ast_to_binary_expr( |
| 423 | schema, |
| 424 | query_condition, |
| 425 | Operator::Lt, |
| 426 | )?), |
| 427 | QueryConditionOp::LE => Ok(leaf_ast_to_binary_expr( |
| 428 | schema, |
| 429 | query_condition, |
| 430 | Operator::LtEq, |
| 431 | )?), |
| 432 | QueryConditionOp::GT => Ok(leaf_ast_to_binary_expr( |
| 433 | schema, |
| 434 | query_condition, |
| 435 | Operator::Gt, |
| 436 | )?), |
| 437 | QueryConditionOp::GE => Ok(leaf_ast_to_binary_expr( |
| 438 | schema, |
| 439 | query_condition, |
| 440 | Operator::GtEq, |
| 441 | )?), |
| 442 | QueryConditionOp::EQ => Ok(leaf_ast_to_binary_expr( |
| 443 | schema, |
| 444 | query_condition, |
| 445 | Operator::Eq, |
| 446 | )?), |
| 447 | QueryConditionOp::NE => Ok(leaf_ast_to_binary_expr( |
| 448 | schema, |
| 449 | query_condition, |
| 450 | Operator::NotEq, |
| 451 | )?), |
| 452 | QueryConditionOp::IN => leaf_ast_to_in_list(schema, query_condition, false), |
| 453 | QueryConditionOp::NOT_IN => leaf_ast_to_in_list(schema, query_condition, true), |
| 454 | QueryConditionOp::ALWAYS_TRUE => { |
| 455 | let Some(field) = schema.field_cxx(query_condition.get_field_name()) else { |
| 456 | return Err(UserError::UnknownField( |
no test coverage detected