-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e28c841
commit 072b43e
Showing
4 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use crate::error::Error; | ||
use crate::execution::Expression; | ||
use dozer_types::types::Record; | ||
use dozer_types::types::{Field, Schema}; | ||
|
||
pub(crate) fn evaluate_nvl( | ||
schema: &Schema, | ||
arg: &mut Expression, | ||
replacement: &mut Expression, | ||
record: &Record, | ||
) -> Result<Field, Error> { | ||
let arg_field = arg.evaluate(record, schema)?; | ||
let replacement_field = replacement.evaluate(record, schema)?; | ||
if replacement_field.as_string().is_some() && arg_field == Field::Null { | ||
Ok(replacement_field) | ||
} else { | ||
Ok(arg_field) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod common; | ||
pub mod field; | ||
pub mod number; | ||
pub mod string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters