MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_jsonb

Function test_jsonb

src/expr/src/interpret.rs:1825–1856  ·  view source on GitHub ↗

error: unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`

()

Source from the content-addressed store, hash-verified

1823 #[mz_ore::test]
1824 #[cfg_attr(miri, ignore)] // error: unsupported operation: can't call foreign function `decNumberFromInt32` on OS `linux`
1825 fn test_jsonb() {
1826 let arena = RowArena::new();
1827
1828 let expr = MirScalarExpr::column(0)
1829 .call_binary(
1830 MirScalarExpr::literal_ok(Datum::from("ts"), ReprScalarType::String),
1831 JsonbGetString,
1832 )
1833 .call_unary(CastJsonbToNumeric(None));
1834
1835 let relation = ReprRelationType::new(vec![ReprScalarType::Jsonb.nullable(true)]);
1836 let mut interpreter = ColumnSpecs::new(&relation, &arena);
1837 interpreter.push_column(
1838 0,
1839 ResultSpec::map_spec(
1840 [(
1841 "ts".into(),
1842 ResultSpec::value_between(
1843 Datum::Numeric(100.into()),
1844 Datum::Numeric(300.into()),
1845 ),
1846 )]
1847 .into_iter()
1848 .collect(),
1849 ),
1850 );
1851
1852 let range_out = interpreter.expr(&expr).range;
1853 assert!(!range_out.may_contain(Datum::Numeric(0.into())));
1854 assert!(range_out.may_contain(Datum::Numeric(200.into())));
1855 assert!(!range_out.may_contain(Datum::Numeric(400.into())));
1856 }
1857
1858 #[mz_ore::test]
1859 fn test_nested_union_partial_overlap() {

Callers

nothing calls this directly

Calls 8

CastJsonbToNumericClass · 0.85
push_columnMethod · 0.80
NumericClass · 0.50
call_unaryMethod · 0.45
call_binaryMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45
exprMethod · 0.45

Tested by

no test coverage detected