diff --git a/src/query/functions/src/scalars/bitmap.rs b/src/query/functions/src/scalars/bitmap.rs index deb79bd93a4b..59b7fbfbf8f3 100644 --- a/src/query/functions/src/scalars/bitmap.rs +++ b/src/query/functions/src/scalars/bitmap.rs @@ -46,6 +46,12 @@ pub fn register(registry: &mut FunctionRegistry) { "to_bitmap", |_, _| FunctionDomain::MayThrow, vectorize_with_builder_1_arg::(|s, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } match parse_bitmap(s.as_bytes()) { Ok(rb) => { rb.serialize_into(&mut builder.data).unwrap(); @@ -61,7 +67,13 @@ pub fn register(registry: &mut FunctionRegistry) { registry.register_passthrough_nullable_1_arg::( "to_bitmap", |_, _| FunctionDomain::Full, - vectorize_with_builder_1_arg::(|arg, builder, _| { + vectorize_with_builder_1_arg::(|arg, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } let mut rb = RoaringTreemap::new(); rb.insert(arg); @@ -76,7 +88,13 @@ pub fn register(registry: &mut FunctionRegistry) { registry.register_passthrough_nullable_1_arg::>>, BitmapType, _, _>( "build_bitmap", |_, _| FunctionDomain::Full, - vectorize_with_builder_1_arg::>>, BitmapType>(|arg, builder, _ctx| { + vectorize_with_builder_1_arg::>>, BitmapType>(|arg, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } let mut rb = RoaringTreemap::new(); for a in arg.iter() { if let Some(a) = a { @@ -100,6 +118,12 @@ pub fn register(registry: &mut FunctionRegistry) { "build_bitmap", |_, _| FunctionDomain::MayThrow, vectorize_with_builder_1_arg::>>, BitmapType>(|arg, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } let mut rb = RoaringTreemap::new(); for a in arg.iter() { if let Some(a) = a { @@ -124,13 +148,19 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_count", |_, _| FunctionDomain::Full, vectorize_with_builder_1_arg::(|arg, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(0_u64); + return; + } + } match deserialize_bitmap(arg) { Ok(rb) => { builder.push(rb.len()); } Err(e) => { - builder.push(0_u64); ctx.set_error(builder.len(), e.to_string()); + builder.push(0_u64); } } }), @@ -142,6 +172,12 @@ pub fn register(registry: &mut FunctionRegistry) { "to_string", |_, _| FunctionDomain::MayThrow, vectorize_with_builder_1_arg::(|b, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } match deserialize_bitmap(b) { Ok(rb) => { let raw = rb.into_iter().collect::>(); @@ -161,13 +197,21 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_contains", |_, _, _| FunctionDomain::Full, vectorize_with_builder_2_arg::( - |b, item, builder, ctx| match deserialize_bitmap(b) { - Ok(rb) => { - builder.push(rb.contains(item)); + |b, item, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(false); + return; + } } - Err(e) => { - builder.push(false); - ctx.set_error(builder.len(), e.to_string()); + match deserialize_bitmap(b) { + Ok(rb) => { + builder.push(rb.contains(item)); + } + Err(e) => { + ctx.set_error(builder.len(), e.to_string()); + builder.push(false); + } } }, ), @@ -177,17 +221,25 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_subset_limit", |_, _, _, _| FunctionDomain::MayThrow, vectorize_with_builder_3_arg::( - |b, range_start, limit, builder, ctx| match deserialize_bitmap(b) { - Ok(rb) => { - let collection = rb.iter().filter(|x| x >= &range_start).take(limit as usize); - let subset_bitmap = RoaringTreemap::from_iter(collection); - subset_bitmap.serialize_into(&mut builder.data).unwrap(); - builder.commit_row(); + |b, range_start, limit, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } } - Err(e) => { - ctx.set_error(builder.len(), e.to_string()); + match deserialize_bitmap(b) { + Ok(rb) => { + let collection = rb.iter().filter(|x| x >= &range_start).take(limit as usize); + let subset_bitmap = RoaringTreemap::from_iter(collection); + subset_bitmap.serialize_into(&mut builder.data).unwrap(); + } + Err(e) => { + ctx.set_error(builder.len(), e.to_string()); + } } - }, + builder.commit_row(); + } ), ); @@ -195,17 +247,25 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_subset_in_range", |_, _, _, _| FunctionDomain::MayThrow, vectorize_with_builder_3_arg::( - |b, start, end, builder, ctx| match deserialize_bitmap(b) { - Ok(rb) => { - let collection = rb.iter().filter(|x| x >= &start && x < &end); - let subset_bitmap = RoaringTreemap::from_iter(collection); - subset_bitmap.serialize_into(&mut builder.data).unwrap(); - builder.commit_row(); + |b, start, end, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } } - Err(e) => { - ctx.set_error(builder.len(), e.to_string()); + match deserialize_bitmap(b) { + Ok(rb) => { + let collection = rb.iter().filter(|x| x >= &start && x < &end); + let subset_bitmap = RoaringTreemap::from_iter(collection); + subset_bitmap.serialize_into(&mut builder.data).unwrap(); + } + Err(e) => { + ctx.set_error(builder.len(), e.to_string()); + } } - }, + builder.commit_row(); + } ), ); @@ -214,6 +274,12 @@ pub fn register(registry: &mut FunctionRegistry) { |_, _, _, _| FunctionDomain::MayThrow, vectorize_with_builder_3_arg::( |b, offset, length, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } match deserialize_bitmap(b) { Ok(rb) => { let subset_start = offset; @@ -221,19 +287,18 @@ pub fn register(registry: &mut FunctionRegistry) { if subset_start >= b.len() as u64 { let rb = RoaringTreemap::new(); rb.serialize_into(&mut builder.data).unwrap(); - builder.commit_row(); } else { let adjusted_length = (subset_start + subset_length).min(b.len() as u64) - subset_start; let subset_bitmap = &rb.into_iter().collect::>()[subset_start as usize..(subset_start + adjusted_length) as usize]; let rb = RoaringTreemap::from_iter(subset_bitmap.iter()); rb.serialize_into(&mut builder.data).unwrap(); - builder.commit_row(); } } Err(e) => { ctx.set_error(builder.len(), e.to_string()); } } + builder.commit_row(); }, ), ); @@ -243,6 +308,12 @@ pub fn register(registry: &mut FunctionRegistry) { |_, _, _| FunctionDomain::Full, vectorize_with_builder_2_arg::( |b, items, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(false); + return; + } + } let rb = match deserialize_bitmap(b) { Ok(rb) => rb, Err(e) => { @@ -269,6 +340,12 @@ pub fn register(registry: &mut FunctionRegistry) { |_, _, _| FunctionDomain::Full, vectorize_with_builder_2_arg::( |b, items, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(false); + return; + } + } let rb = match deserialize_bitmap(b) { Ok(rb) => rb, Err(e) => { @@ -294,6 +371,12 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_max", |_, _| FunctionDomain::MayThrow, vectorize_with_builder_1_arg::(|b, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(0); + return; + } + } let val = match deserialize_bitmap(b) { Ok(rb) => match rb.max() { Some(val) => val, @@ -315,6 +398,12 @@ pub fn register(registry: &mut FunctionRegistry) { "bitmap_min", |_, _| FunctionDomain::MayThrow, vectorize_with_builder_1_arg::(|b, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(0); + return; + } + } let val = match deserialize_bitmap(b) { Ok(rb) => match rb.min() { Some(val) => val, @@ -382,6 +471,12 @@ fn bitmap_logic_operate( ctx: &mut EvalContext, op: LogicOp, ) { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.commit_row(); + return; + } + } let Some(rb1) = deserialize_bitmap(arg1) .map_err(|e| { ctx.set_error(builder.len(), e.to_string()); diff --git a/src/query/functions/src/scalars/geometry.rs b/src/query/functions/src/scalars/geometry.rs index e6bc2147b83b..a3f9f5411fb6 100644 --- a/src/query/functions/src/scalars/geometry.rs +++ b/src/query/functions/src/scalars/geometry.rs @@ -224,11 +224,17 @@ pub fn register(registry: &mut FunctionRegistry) { }), ); - registry.register_combine_nullable_2_arg::( + registry.register_passthrough_nullable_2_arg::( "st_contains", |_, _, _| FunctionDomain::MayThrow, - vectorize_with_builder_2_arg::>( + vectorize_with_builder_2_arg::( |l_geometry, r_geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(false); + return; + } + } let l_ewkb = Ewkb(l_geometry); let r_ewkb = Ewkb(r_geometry); let l_geos: Geometry = l_ewkb.to_geos().unwrap(); @@ -236,18 +242,17 @@ pub fn register(registry: &mut FunctionRegistry) { let l_srid = l_geos.srid(); let r_srid = r_geos.srid(); if l_srid != r_srid { - builder.push_null(); ctx.set_error( builder.len(), ErrorCode::GeometryError("Srid does not match!").to_string(), ); + builder.push(false); } else { let l_geo: geo::Geometry = l_geos.to_geo().unwrap(); let r_geo: geo::Geometry = r_geos.to_geo().unwrap(); if matches!(l_geo, geo::Geometry::GeometryCollection(_)) || matches!(r_geo, geo::Geometry::GeometryCollection(_)) { - builder.push_null(); ctx.set_error( builder.len(), ErrorCode::GeometryError( @@ -255,6 +260,7 @@ pub fn register(registry: &mut FunctionRegistry) { ) .to_string(), ); + builder.push(false); } else { builder.push(l_geo.contains(&r_geo)); } @@ -263,59 +269,54 @@ pub fn register(registry: &mut FunctionRegistry) { ), ); - registry.register_combine_nullable_2_arg::, _, _>( - "st_distance", - |_, _, _| FunctionDomain::MayThrow, - vectorize_with_builder_2_arg::>>( - |l_geometry, r_geometry, builder, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(builder.len()) { - builder.push_null(); - return; + registry + .register_passthrough_nullable_2_arg::, _, _>( + "st_distance", + |_, _, _| FunctionDomain::MayThrow, + vectorize_with_builder_2_arg::>( + |l_geometry, r_geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(F64::from(0_f64)); + return; + } } - } - let left_geo = Ewkb(l_geometry); - let right_geo = Ewkb(r_geometry); - let geos = &vec![left_geo.to_geos().unwrap(), right_geo.to_geos().unwrap()]; - match get_shared_srid(geos).map_err(|e| ErrorCode::GeometryError(e).to_string()) { - Ok(_) => {} - Err(err_msg) => { - ctx.set_error(builder.len(), err_msg); - return; - } - } - - let l_point = match >::try_into( - Ewkb(l_geometry).to_geo().unwrap(), - ) { - Ok(point) => point, - Err(e) => { + let left_geo = Ewkb(l_geometry); + let right_geo = Ewkb(r_geometry); + let geos = &vec![left_geo.to_geos().unwrap(), right_geo.to_geos().unwrap()]; + if let Err(e) = get_shared_srid(geos) { ctx.set_error( builder.len(), ErrorCode::GeometryError(e.to_string()).to_string(), ); + builder.push(F64::from(0_f64)); return; } - }; - let r_point = match >::try_into( - Ewkb(r_geometry).to_geo().unwrap(), - ) { - Ok(point) => point, - Err(e) => { - ctx.set_error( - builder.len(), - ErrorCode::GeometryError(e.to_string()).to_string(), - ); - return; + match ( + >::try_into( + left_geo.to_geo().unwrap(), + ), + >::try_into( + right_geo.to_geo().unwrap(), + ), + ) { + (Ok(l_point), Ok(r_point)) => { + let distance = l_point.euclidean_distance(&r_point); + builder.push(format!("{:.9}", distance).parse().unwrap()); + } + (Err(e), _) | (_, Err(e)) => { + ctx.set_error( + builder.len(), + ErrorCode::GeometryError(e.to_string()).to_string(), + ); + builder.push(F64::from(0_f64)); + } } - }; - let distance = l_point.euclidean_distance(&r_point); - builder.push(format!("{:.9}", distance).parse().unwrap()); - }, - ), - ); + }, + ), + ); registry.register_passthrough_nullable_1_arg::( "st_endpoint", @@ -380,7 +381,7 @@ pub fn register(registry: &mut FunctionRegistry) { ctx.set_error( builder.len(), ErrorCode::GeometryError(format!( - "Index { } is out of bounds", + "Index {} is out of bounds", index )) .to_string(), @@ -784,6 +785,7 @@ pub fn register(registry: &mut FunctionRegistry) { builder.commit_row(); }), ); + registry.register_passthrough_nullable_2_arg::( "st_geometryfromwkb", |_, _, _| FunctionDomain::MayThrow, @@ -945,108 +947,108 @@ pub fn register(registry: &mut FunctionRegistry) { }), ); - registry.register_combine_nullable_1_arg::, _, _>( + registry.register_passthrough_nullable_1_arg::, _, _>( "st_length", - |_, _| FunctionDomain::MayThrow, - vectorize_with_builder_1_arg::>>( - |geometry, builder, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(builder.len()) { - builder.push_null(); - return; - } + |_, _| FunctionDomain::Full, + vectorize_with_builder_1_arg::>(|geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(F64::from(0_f64)); + return; } + } - let g: geo_types::Geometry = Ewkb(geometry).to_geos().unwrap().try_into().unwrap(); - let mut distance = 0f64; - match g { - geo_types::Geometry::LineString(lines) => { - for line in lines.lines() { + let g: geo_types::Geometry = Ewkb(geometry).to_geos().unwrap().try_into().unwrap(); + let mut distance = 0f64; + match g { + geo_types::Geometry::LineString(lines) => { + for line in lines.lines() { + distance += line.euclidean_length(); + } + } + geo_types::Geometry::MultiLineString(multi_lines) => { + for line_string in multi_lines.0 { + for line in line_string.lines() { distance += line.euclidean_length(); } } - geo_types::Geometry::MultiLineString(multi_lines) => { - for line_string in multi_lines.0 { + } + geo_types::Geometry::GeometryCollection(geom_c) => { + for geometry in geom_c.0 { + if let geo::Geometry::LineString(line_string) = geometry { for line in line_string.lines() { distance += line.euclidean_length(); } } } - geo_types::Geometry::GeometryCollection(geom_c) => { - for geometry in geom_c.0 { - if let geo::Geometry::LineString(line_string) = geometry { - for line in line_string.lines() { - distance += line.euclidean_length(); - } - } - } - } - _ => {} } + _ => {} + } - builder.push(format!("{:.9}", distance).parse().unwrap()); - }, - ), + builder.push(format!("{:.9}", distance).parse().unwrap()); + }), ); - registry.register_combine_nullable_1_arg::, _, _>( + registry.register_passthrough_nullable_1_arg::, _, _>( "st_x", |_, _| FunctionDomain::MayThrow, - vectorize_with_builder_1_arg::>>( - |geometry, builder, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(builder.len()) { - builder.push_null(); - return; - } + vectorize_with_builder_1_arg::>(|geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(F64::from(0_f64)); + return; } + } - match >::try_into( - Ewkb(geometry).to_geo().unwrap(), - ) { - Ok(point) => builder.push(F64::from(AsPrimitive::::as_(point.x()))), - Err(e) => ctx.set_error( + match >::try_into( + Ewkb(geometry).to_geo().unwrap(), + ) { + Ok(point) => builder.push(F64::from(AsPrimitive::::as_(point.x()))), + Err(e) => { + ctx.set_error( builder.len(), ErrorCode::GeometryError(e.to_string()).to_string(), - ), - }; - }, - ), + ); + builder.push(F64::from(0_f64)); + } + }; + }), ); - registry.register_combine_nullable_1_arg::, _, _>( + registry.register_passthrough_nullable_1_arg::, _, _>( "st_y", |_, _| FunctionDomain::MayThrow, - vectorize_with_builder_1_arg::>>( - |geometry, builder, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(builder.len()) { - builder.push_null(); - return; - } + vectorize_with_builder_1_arg::>(|geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(F64::from(0_f64)); + return; } + } - match >::try_into( - Ewkb(geometry).to_geo().unwrap(), - ) { - Ok(point) => builder.push(F64::from(AsPrimitive::::as_(point.y()))), - Err(e) => ctx.set_error( + match >::try_into( + Ewkb(geometry).to_geo().unwrap(), + ) { + Ok(point) => builder.push(F64::from(AsPrimitive::::as_(point.y()))), + Err(e) => { + ctx.set_error( builder.len(), ErrorCode::GeometryError(e.to_string()).to_string(), - ), - }; - }, - ), + ); + builder.push(F64::from(0_f64)); + } + }; + }), ); - registry.register_combine_nullable_2_arg::( + registry.register_passthrough_nullable_2_arg::( "st_setsrid", |_, _, _| FunctionDomain::Full, - vectorize_with_builder_2_arg::>( + vectorize_with_builder_2_arg::( |geometry, srid, output, ctx| { if let Some(validity) = &ctx.validity { if !validity.get_bit(output.len()) { - output.push_null(); + output.commit_row(); return; } } @@ -1054,26 +1056,25 @@ pub fn register(registry: &mut FunctionRegistry) { let mut ggeom = ewkb.to_geos().unwrap(); ggeom.set_srid(srid as usize); let geo = ggeom.to_ewkb(ggeom.dims(), ggeom.srid()).unwrap(); - output.push(&geo); + output.put_slice(&geo); + output.commit_row(); }, ), ); - registry.register_combine_nullable_1_arg::( + registry.register_passthrough_nullable_1_arg::( "st_srid", |_, _| FunctionDomain::Full, - vectorize_with_builder_1_arg::>( - |geometry, output, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(output.len()) { - output.push_null(); - return; - } + vectorize_with_builder_1_arg::(|geometry, output, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(output.len()) { + output.push(0); + return; } + } - output.push(Ewkb(geometry).to_geos().unwrap().srid().unwrap_or(4326)); - }, - ), + output.push(Ewkb(geometry).to_geos().unwrap().srid().unwrap_or(4326)); + }), ); registry.register_combine_nullable_1_arg::, _, _>( @@ -1155,20 +1156,18 @@ pub fn register(registry: &mut FunctionRegistry) { ), ); - registry.register_combine_nullable_1_arg::( + registry.register_passthrough_nullable_1_arg::( "st_npoints", |_, _| FunctionDomain::Full, - vectorize_with_builder_1_arg::>( - |geometry, builder, ctx| { - if let Some(validity) = &ctx.validity { - if !validity.get_bit(builder.len()) { - builder.push_null(); - return; - } + vectorize_with_builder_1_arg::(|geometry, builder, ctx| { + if let Some(validity) = &ctx.validity { + if !validity.get_bit(builder.len()) { + builder.push(0); + return; } - builder.push(count_points(&Ewkb(geometry).to_geo().unwrap()) as u32); - }, - ), + } + builder.push(count_points(&Ewkb(geometry).to_geo().unwrap()) as u32); + }), ); registry.register_passthrough_nullable_1_arg::( diff --git a/src/query/functions/tests/it/scalars/testdata/function_list.txt b/src/query/functions/tests/it/scalars/testdata/function_list.txt index 6667a5055a4b..f06818576778 100644 --- a/src/query/functions/tests/it/scalars/testdata/function_list.txt +++ b/src/query/functions/tests/it/scalars/testdata/function_list.txt @@ -3553,11 +3553,11 @@ Functions overloads: 1 st_aswkb(Geometry NULL) :: Binary NULL 0 st_aswkt(Geometry) :: String 1 st_aswkt(Geometry NULL) :: String NULL -0 st_contains(Geometry, Geometry) :: Boolean NULL +0 st_contains(Geometry, Geometry) :: Boolean 1 st_contains(Geometry NULL, Geometry NULL) :: Boolean NULL 0 st_dimension(Geometry) :: Int32 NULL 1 st_dimension(Geometry NULL) :: Int32 NULL -0 st_distance(Geometry, Geometry) :: Float64 NULL +0 st_distance(Geometry, Geometry) :: Float64 1 st_distance(Geometry NULL, Geometry NULL) :: Float64 NULL 0 st_endpoint(Geometry) :: Geometry 1 st_endpoint(Geometry NULL) :: Geometry NULL @@ -3581,7 +3581,7 @@ Functions overloads: 1 st_geomfromgeohash(String NULL) :: Geometry NULL 0 st_geompointfromgeohash(String) :: Geometry 1 st_geompointfromgeohash(String NULL) :: Geometry NULL -0 st_length(Geometry) :: Float64 NULL +0 st_length(Geometry) :: Float64 1 st_length(Geometry NULL) :: Float64 NULL 0 st_makegeompoint(Float64, Float64) :: Geometry 1 st_makegeompoint(Float64 NULL, Float64 NULL) :: Geometry NULL @@ -3589,13 +3589,13 @@ Functions overloads: 1 st_makeline(Geometry NULL, Geometry NULL) :: Geometry NULL 0 st_makepolygon(Geometry) :: Geometry 1 st_makepolygon(Geometry NULL) :: Geometry NULL -0 st_npoints(Geometry) :: UInt32 NULL +0 st_npoints(Geometry) :: UInt32 1 st_npoints(Geometry NULL) :: UInt32 NULL 0 st_pointn(Geometry, Int32) :: Geometry 1 st_pointn(Geometry NULL, Int32 NULL) :: Geometry NULL -0 st_setsrid(Geometry, Int32) :: Geometry NULL +0 st_setsrid(Geometry, Int32) :: Geometry 1 st_setsrid(Geometry NULL, Int32 NULL) :: Geometry NULL -0 st_srid(Geometry) :: Int32 NULL +0 st_srid(Geometry) :: Int32 1 st_srid(Geometry NULL) :: Int32 NULL 0 st_startpoint(Geometry) :: Geometry 1 st_startpoint(Geometry NULL) :: Geometry NULL @@ -3603,13 +3603,13 @@ Functions overloads: 1 st_transform(Geometry NULL, Int32 NULL) :: Geometry NULL 2 st_transform(Geometry, Int32, Int32) :: Geometry 3 st_transform(Geometry NULL, Int32 NULL, Int32 NULL) :: Geometry NULL -0 st_x(Geometry) :: Float64 NULL +0 st_x(Geometry) :: Float64 1 st_x(Geometry NULL) :: Float64 NULL 0 st_xmax(Geometry) :: Float64 NULL 1 st_xmax(Geometry NULL) :: Float64 NULL 0 st_xmin(Geometry) :: Float64 NULL 1 st_xmin(Geometry NULL) :: Float64 NULL -0 st_y(Geometry) :: Float64 NULL +0 st_y(Geometry) :: Float64 1 st_y(Geometry NULL) :: Float64 NULL 0 st_ymax(Geometry) :: Float64 NULL 1 st_ymax(Geometry NULL) :: Float64 NULL diff --git a/src/query/functions/tests/it/scalars/testdata/geometry.txt b/src/query/functions/tests/it/scalars/testdata/geometry.txt index 96871e00103a..7d148752ef2c 100644 --- a/src/query/functions/tests/it/scalars/testdata/geometry.txt +++ b/src/query/functions/tests/it/scalars/testdata/geometry.txt @@ -83,7 +83,7 @@ ast : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_ raw expr : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))')) checked expr : st_contains(to_geometry("POLYGON((-2 0, 0 2, 2 0, -2 0))"), to_geometry("POLYGON((-2 0, 0 2, 2 0, -2 0))")) optimized expr : true -output type : Boolean NULL +output type : Boolean output domain : {TRUE} output : true @@ -92,7 +92,7 @@ ast : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_ raw expr : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_GEOMETRY('POLYGON((-1 0, 0 1, 1 0, -1 0))')) checked expr : st_contains(to_geometry("POLYGON((-2 0, 0 2, 2 0, -2 0))"), to_geometry("POLYGON((-1 0, 0 1, 1 0, -1 0))")) optimized expr : true -output type : Boolean NULL +output type : Boolean output domain : {TRUE} output : true @@ -101,7 +101,7 @@ ast : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_ raw expr : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_GEOMETRY('LINESTRING(-1 1, 0 2, 1 1))')) checked expr : st_contains(to_geometry("POLYGON((-2 0, 0 2, 2 0, -2 0))"), to_geometry("LINESTRING(-1 1, 0 2, 1 1))")) optimized expr : false -output type : Boolean NULL +output type : Boolean output domain : {FALSE} output : false @@ -110,7 +110,7 @@ ast : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_ raw expr : ST_CONTAINS(TO_GEOMETRY('POLYGON((-2 0, 0 2, 2 0, -2 0))'), TO_GEOMETRY('LINESTRING(-2 0, 0 0, 0 1))')) checked expr : st_contains(to_geometry("POLYGON((-2 0, 0 2, 2 0, -2 0))"), to_geometry("LINESTRING(-2 0, 0 0, 0 1))")) optimized expr : true -output type : Boolean NULL +output type : Boolean output domain : {TRUE} output : true @@ -200,7 +200,7 @@ ast : st_distance(to_geometry('POINT(0 0)'), to_geometry('POINT(1 1)' raw expr : st_distance(to_geometry('POINT(0 0)'), to_geometry('POINT(1 1)')) checked expr : st_distance(to_geometry("POINT(0 0)"), to_geometry("POINT(1 1)")) optimized expr : 1.414213562_f64 -output type : Float64 NULL +output type : Float64 output domain : {1.414213562..=1.414213562} output : 1.414213562 @@ -275,7 +275,7 @@ ast : st_length(to_geometry('POINT(1 1)')) raw expr : st_length(to_geometry('POINT(1 1)')) checked expr : st_length(to_geometry("POINT(1 1)")) optimized expr : 0_f64 -output type : Float64 NULL +output type : Float64 output domain : {0..=0} output : 0 @@ -284,7 +284,7 @@ ast : st_length(to_geometry('LINESTRING(0 0, 1 1)')) raw expr : st_length(to_geometry('LINESTRING(0 0, 1 1)')) checked expr : st_length(to_geometry("LINESTRING(0 0, 1 1)")) optimized expr : 1.414213562_f64 -output type : Float64 NULL +output type : Float64 output domain : {1.414213562..=1.414213562} output : 1.414213562 @@ -293,7 +293,7 @@ ast : st_length(to_geometry('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')) raw expr : st_length(to_geometry('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))')) checked expr : st_length(to_geometry("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))")) optimized expr : 0_f64 -output type : Float64 NULL +output type : Float64 output domain : {0..=0} output : 0 @@ -415,7 +415,7 @@ ast : st_npoints(to_geometry('POINT(66 12)')) raw expr : st_npoints(to_geometry('POINT(66 12)')) checked expr : st_npoints(to_geometry("POINT(66 12)")) optimized expr : 1_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {1..=1} output : 1 @@ -424,7 +424,7 @@ ast : st_npoints(to_geometry('MULTIPOINT((45 21), (12 54))')) raw expr : st_npoints(to_geometry('MULTIPOINT((45 21), (12 54))')) checked expr : st_npoints(to_geometry("MULTIPOINT((45 21), (12 54))")) optimized expr : 2_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {2..=2} output : 2 @@ -433,7 +433,7 @@ ast : st_npoints(to_geometry('LINESTRING(40 60, 50 50, 60 40)')) raw expr : st_npoints(to_geometry('LINESTRING(40 60, 50 50, 60 40)')) checked expr : st_npoints(to_geometry("LINESTRING(40 60, 50 50, 60 40)")) optimized expr : 3_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {3..=3} output : 3 @@ -442,7 +442,7 @@ ast : st_npoints(to_geometry('MULTILINESTRING((1 1, 32 17), (33 12, 7 raw expr : st_npoints(to_geometry('MULTILINESTRING((1 1, 32 17), (33 12, 73 49, 87.1 6.1))')) checked expr : st_npoints(to_geometry("MULTILINESTRING((1 1, 32 17), (33 12, 73 49, 87.1 6.1))")) optimized expr : 5_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {5..=5} output : 5 @@ -451,7 +451,7 @@ ast : st_npoints(to_geometry('POLYGON((17 17, 17 30, 30 30, 30 17, 17 raw expr : st_npoints(to_geometry('POLYGON((17 17, 17 30, 30 30, 30 17, 17 17))')) checked expr : st_npoints(to_geometry("POLYGON((17 17, 17 30, 30 30, 30 17, 17 17))")) optimized expr : 5_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {5..=5} output : 5 @@ -460,7 +460,7 @@ ast : st_npoints(to_geometry('MULTIPOLYGON(((-10 0,0 10,10 0,-10 0)), raw expr : st_npoints(to_geometry('MULTIPOLYGON(((-10 0,0 10,10 0,-10 0)),((-10 40,10 40,0 20,-10 40)))')) checked expr : st_npoints(to_geometry("MULTIPOLYGON(((-10 0,0 10,10 0,-10 0)),((-10 40,10 40,0 20,-10 40)))")) optimized expr : 8_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {8..=8} output : 8 @@ -469,7 +469,7 @@ ast : st_npoints(to_geometry('GEOMETRYCOLLECTION(POLYGON((-10 0,0 10, raw expr : st_npoints(to_geometry('GEOMETRYCOLLECTION(POLYGON((-10 0,0 10,10 0,-10 0)),LINESTRING(40 60, 50 50, 60 40), POINT(99 11))')) checked expr : st_npoints(to_geometry("GEOMETRYCOLLECTION(POLYGON((-10 0,0 10,10 0,-10 0)),LINESTRING(40 60, 50 50, 60 40), POINT(99 11))")) optimized expr : 8_u32 -output type : UInt32 NULL +output type : UInt32 output domain : {8..=8} output : 8 @@ -496,7 +496,7 @@ ast : st_setsrid(to_geometry('POINT(13 51)'), 4326) raw expr : st_setsrid(to_geometry('POINT(13 51)'), 4326) checked expr : st_setsrid(to_geometry("POINT(13 51)"), to_int32(4326_u16)) optimized expr : "SRID=4326;POINT(13 51)" -output type : Geometry NULL +output type : Geometry output domain : Undefined output : 'SRID=4326;POINT(13 51)' @@ -505,7 +505,7 @@ ast : st_srid(to_geometry('POINT(-122.306100 37.554162)', 1234)) raw expr : st_srid(to_geometry('POINT(-122.306100 37.554162)', 1234)) checked expr : st_srid(to_geometry("POINT(-122.306100 37.554162)", to_int32(1234_u16))) optimized expr : 1234_i32 -output type : Int32 NULL +output type : Int32 output domain : {1234..=1234} output : 1234 @@ -514,7 +514,7 @@ ast : st_srid(st_makegeompoint(37.5, 45.5)) raw expr : st_srid(st_makegeompoint(37.5, 45.5)) checked expr : st_srid(st_makegeompoint(to_float64(37.5_d128(3,1)), to_float64(45.5_d128(3,1)))) optimized expr : 4326_i32 -output type : Int32 NULL +output type : Int32 output domain : {4326..=4326} output : 4326 @@ -550,7 +550,7 @@ ast : st_x(st_makegeompoint(37.5, 45.5)) raw expr : st_x(st_makegeompoint(37.5, 45.5)) checked expr : st_x(st_makegeompoint(to_float64(37.5_d128(3,1)), to_float64(45.5_d128(3,1)))) optimized expr : 37.5_f64 -output type : Float64 NULL +output type : Float64 output domain : {37.5..=37.5} output : 37.5 @@ -577,7 +577,7 @@ ast : st_y(st_makegeompoint(37.5, 45.5)) raw expr : st_y(st_makegeompoint(37.5, 45.5)) checked expr : st_y(st_makegeompoint(to_float64(37.5_d128(3,1)), to_float64(45.5_d128(3,1)))) optimized expr : 45.5_f64 -output type : Float64 NULL +output type : Float64 output domain : {45.5..=45.5} output : 45.5