@@ -4804,7 +4804,7 @@ struct ST_GeomFromWKB {
48044804 y_data[i] = vertex.y ;
48054805 }
48064806
4807- if (args.AllConstant ()) {
4807+ if (args.AllConstant () || args. size () == 1 ) {
48084808 result.SetVectorType (VectorType::CONSTANT_VECTOR);
48094809 }
48104810 }
@@ -4872,7 +4872,7 @@ struct ST_GeomFromWKB {
48724872
48734873 ListVector::SetListSize (result, total_size);
48744874
4875- if (args.AllConstant ()) {
4875+ if (args.AllConstant () || args. size () == 1 ) {
48764876 result.SetVectorType (VectorType::CONSTANT_VECTOR);
48774877 }
48784878 }
@@ -4967,7 +4967,7 @@ struct ST_GeomFromWKB {
49674967 ListVector::SetListSize (result, total_ring_count);
49684968 ListVector::SetListSize (ring_vec, total_point_count);
49694969
4970- if (count == 1 ) {
4970+ if (args. AllConstant () || args. size () == 1 ) {
49714971 result.SetVectorType (VectorType::CONSTANT_VECTOR);
49724972 }
49734973 }
@@ -4986,8 +4986,16 @@ struct ST_GeomFromWKB {
49864986 static void Register (ExtensionLoader &loader) {
49874987 FunctionBuilder::RegisterScalar (loader, " ST_Point2DFromWKB" , [](ScalarFunctionBuilder &builder) {
49884988 builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
4989- variant.AddParameter (" point" , GeoTypes::POINT_2D ());
4990- variant.SetReturnType (GeoTypes::GEOMETRY ());
4989+ variant.AddParameter (" wkb" , GeoTypes::WKB_BLOB ());
4990+ variant.SetReturnType (GeoTypes::POINT_2D ());
4991+
4992+ variant.SetInit (LocalState::Init);
4993+ variant.SetFunction (ExecutePoint);
4994+ });
4995+
4996+ builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
4997+ variant.AddParameter (" blob" , LogicalType::BLOB);
4998+ variant.SetReturnType (GeoTypes::POINT_2D ());
49914999
49925000 variant.SetInit (LocalState::Init);
49935001 variant.SetFunction (ExecutePoint);
@@ -5001,8 +5009,16 @@ struct ST_GeomFromWKB {
50015009
50025010 FunctionBuilder::RegisterScalar (loader, " ST_LineString2DFromWKB" , [](ScalarFunctionBuilder &builder) {
50035011 builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
5004- variant.AddParameter (" linestring" , GeoTypes::LINESTRING_2D ());
5005- variant.SetReturnType (GeoTypes::GEOMETRY ());
5012+ variant.AddParameter (" wkb" , GeoTypes::WKB_BLOB ());
5013+ variant.SetReturnType (GeoTypes::LINESTRING_2D ());
5014+
5015+ variant.SetInit (LocalState::Init);
5016+ variant.SetFunction (ExecuteLineString);
5017+ });
5018+
5019+ builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
5020+ variant.AddParameter (" blob" , LogicalType::BLOB);
5021+ variant.SetReturnType (GeoTypes::LINESTRING_2D ());
50065022
50075023 variant.SetInit (LocalState::Init);
50085024 variant.SetFunction (ExecuteLineString);
@@ -5016,8 +5032,15 @@ struct ST_GeomFromWKB {
50165032
50175033 FunctionBuilder::RegisterScalar (loader, " ST_Polygon2DFromWKB" , [](ScalarFunctionBuilder &builder) {
50185034 builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
5019- variant.AddParameter (" polygon" , GeoTypes::POLYGON_2D ());
5020- variant.SetReturnType (GeoTypes::GEOMETRY ());
5035+ variant.AddParameter (" wkb" , GeoTypes::WKB_BLOB ());
5036+ variant.SetReturnType (GeoTypes::POLYGON_2D ());
5037+
5038+ variant.SetInit (LocalState::Init);
5039+ variant.SetFunction (ExecutePolygon);
5040+ });
5041+ builder.AddVariant ([](ScalarFunctionVariantBuilder &variant) {
5042+ variant.AddParameter (" blob" , LogicalType::BLOB);
5043+ variant.SetReturnType (GeoTypes::POLYGON_2D ());
50215044
50225045 variant.SetInit (LocalState::Init);
50235046 variant.SetFunction (ExecutePolygon);
@@ -5252,7 +5275,7 @@ struct ST_LineInterpolatePoint {
52525275 auto &lstate = LocalState::ResetAndGet (state);
52535276
52545277 BinaryExecutor::Execute<string_t , double , string_t >(
5255- args.data [0 ], args.data [1 ], result, args.size (), [&](const string_t &blob, const double faction ) {
5278+ args.data [0 ], args.data [1 ], result, args.size (), [&](const string_t &blob, const double fraction ) {
52565279 sgl::geometry geom;
52575280 lstate.Deserialize (blob, geom);
52585281
@@ -5261,7 +5284,7 @@ struct ST_LineInterpolatePoint {
52615284 }
52625285
52635286 sgl::vertex_xyzm out_vertex = {0 , 0 , 0 , 0 };
5264- if (sgl::linestring::interpolate (geom, faction , out_vertex)) {
5287+ if (sgl::linestring::interpolate (geom, fraction , out_vertex)) {
52655288 sgl::geometry point (sgl::geometry_type::POINT, geom.has_z (), geom.has_m ());
52665289 point.set_vertex_array (&out_vertex, 1 );
52675290 return lstate.Serialize (result, point);
@@ -6092,7 +6115,7 @@ struct ST_Hilbert {
60926115 static constexpr auto DESCRIPTION = R"(
60936116 Encodes the X and Y values as the hilbert curve index for a curve covering the given bounding box.
60946117 If a geometry is provided, the center of the approximate bounding box is used as the point to encode.
6095- If no bounding box is provided, the hilbert curve index is mapped to the full range of a single-presicion float.
6118+ If no bounding box is provided, the hilbert curve index is mapped to the full range of a single-precision float.
60966119 For the BOX_2D and BOX_2DF variants, the center of the box is used as the point to encode.
60976120 )" ;
60986121
0 commit comments