@@ -837,98 +837,6 @@ def normalize_op_impl(x: ibis_types.Value):
837837 return result .cast (result_type )
838838
839839
840- # Geo Ops
841- @scalar_op_compiler .register_unary_op (ops .geo_area_op )
842- def geo_area_op_impl (x : ibis_types .Value ):
843- return typing .cast (ibis_types .GeoSpatialValue , x ).area ()
844-
845-
846- @scalar_op_compiler .register_unary_op (ops .geo_st_astext_op )
847- def geo_st_astext_op_impl (x : ibis_types .Value ):
848- return typing .cast (ibis_types .GeoSpatialValue , x ).as_text ()
849-
850-
851- @scalar_op_compiler .register_unary_op (ops .geo_st_boundary_op , pass_op = False )
852- def geo_st_boundary_op_impl (x : ibis_types .Value ):
853- return st_boundary (x )
854-
855-
856- @scalar_op_compiler .register_unary_op (ops .GeoStBufferOp , pass_op = True )
857- def geo_st_buffer_op_impl (x : ibis_types .Value , op : ops .GeoStBufferOp ):
858- return st_buffer (
859- x ,
860- op .buffer_radius ,
861- op .num_seg_quarter_circle ,
862- op .use_spheroid ,
863- )
864-
865-
866- @scalar_op_compiler .register_unary_op (ops .geo_st_centroid_op , pass_op = False )
867- def geo_st_centroid_op_impl (x : ibis_types .Value ):
868- return typing .cast (ibis_types .GeoSpatialValue , x ).centroid ()
869-
870-
871- @scalar_op_compiler .register_unary_op (ops .geo_st_convexhull_op , pass_op = False )
872- def geo_st_convexhull_op_impl (x : ibis_types .Value ):
873- return st_convexhull (x )
874-
875-
876- @scalar_op_compiler .register_binary_op (ops .geo_st_difference_op , pass_op = False )
877- def geo_st_difference_op_impl (x : ibis_types .Value , y : ibis_types .Value ):
878- return typing .cast (ibis_types .GeoSpatialValue , x ).difference (
879- typing .cast (ibis_types .GeoSpatialValue , y )
880- )
881-
882-
883- @scalar_op_compiler .register_binary_op (ops .GeoStDistanceOp , pass_op = True )
884- def geo_st_distance_op_impl (
885- x : ibis_types .Value , y : ibis_types .Value , op : ops .GeoStDistanceOp
886- ):
887- return st_distance (x , y , op .use_spheroid )
888-
889-
890- @scalar_op_compiler .register_unary_op (ops .geo_st_geogfromtext_op )
891- def geo_st_geogfromtext_op_impl (x : ibis_types .Value ):
892- # Ibis doesn't seem to provide a dedicated method to cast from string to geography,
893- # so we use a BigQuery scalar function, st_geogfromtext(), directly.
894- return st_geogfromtext (x )
895-
896-
897- @scalar_op_compiler .register_binary_op (ops .geo_st_geogpoint_op , pass_op = False )
898- def geo_st_geogpoint_op_impl (x : ibis_types .Value , y : ibis_types .Value ):
899- return typing .cast (ibis_types .NumericValue , x ).point (
900- typing .cast (ibis_types .NumericValue , y )
901- )
902-
903-
904- @scalar_op_compiler .register_binary_op (ops .geo_st_intersection_op , pass_op = False )
905- def geo_st_intersection_op_impl (x : ibis_types .Value , y : ibis_types .Value ):
906- return typing .cast (ibis_types .GeoSpatialValue , x ).intersection (
907- typing .cast (ibis_types .GeoSpatialValue , y )
908- )
909-
910-
911- @scalar_op_compiler .register_unary_op (ops .geo_st_isclosed_op , pass_op = False )
912- def geo_st_isclosed_op_impl (x : ibis_types .Value ):
913- return st_isclosed (x )
914-
915-
916- @scalar_op_compiler .register_unary_op (ops .geo_x_op )
917- def geo_x_op_impl (x : ibis_types .Value ):
918- return typing .cast (ibis_types .GeoSpatialValue , x ).x ()
919-
920-
921- @scalar_op_compiler .register_unary_op (ops .GeoStLengthOp , pass_op = True )
922- def geo_length_op_impl (x : ibis_types .Value , op : ops .GeoStLengthOp ):
923- # Call the st_length UDF defined in this file (or imported)
924- return st_length (x , op .use_spheroid )
925-
926-
927- @scalar_op_compiler .register_unary_op (ops .geo_y_op )
928- def geo_y_op_impl (x : ibis_types .Value ):
929- return typing .cast (ibis_types .GeoSpatialValue , x ).y ()
930-
931-
932840# Parameterized ops
933841@scalar_op_compiler .register_unary_op (ops .StructFieldOp , pass_op = True )
934842def struct_field_op_impl (x : ibis_types .Value , op : ops .StructFieldOp ):
@@ -2092,17 +2000,6 @@ def _ibis_num(number: float):
20922000 return typing .cast (ibis_types .NumericValue , ibis_types .literal (number ))
20932001
20942002
2095- @ibis_udf .scalar .builtin
2096- def st_convexhull (x : ibis_dtypes .geography ) -> ibis_dtypes .geography : # type: ignore
2097- """ST_CONVEXHULL"""
2098- ...
2099-
2100-
2101- @ibis_udf .scalar .builtin
2102- def st_geogfromtext (a : str ) -> ibis_dtypes .geography : # type: ignore
2103- """Convert string to geography."""
2104-
2105-
21062003@ibis_udf .scalar .builtin
21072004def timestamp (a : str ) -> ibis_dtypes .timestamp : # type: ignore
21082005 """Convert string to timestamp."""
@@ -2113,32 +2010,6 @@ def unix_millis(a: ibis_dtypes.timestamp) -> int: # type: ignore
21132010 """Convert a timestamp to milliseconds"""
21142011
21152012
2116- @ibis_udf .scalar .builtin
2117- def st_boundary (a : ibis_dtypes .geography ) -> ibis_dtypes .geography : # type: ignore
2118- """Find the boundary of a geography."""
2119-
2120-
2121- @ibis_udf .scalar .builtin
2122- def st_buffer (
2123- geography : ibis_dtypes .geography , # type: ignore
2124- buffer_radius : ibis_dtypes .Float64 ,
2125- num_seg_quarter_circle : ibis_dtypes .Float64 ,
2126- use_spheroid : ibis_dtypes .Boolean ,
2127- ) -> ibis_dtypes .geography : # type: ignore
2128- ...
2129-
2130-
2131- @ibis_udf .scalar .builtin
2132- def st_distance (a : ibis_dtypes .geography , b : ibis_dtypes .geography , use_spheroid : bool ) -> ibis_dtypes .float : # type: ignore
2133- """Convert string to geography."""
2134-
2135-
2136- @ibis_udf .scalar .builtin
2137- def st_length (geog : ibis_dtypes .geography , use_spheroid : bool ) -> ibis_dtypes .float : # type: ignore
2138- """ST_LENGTH BQ builtin. This body is never executed."""
2139- pass
2140-
2141-
21422013@ibis_udf .scalar .builtin
21432014def unix_micros (a : ibis_dtypes .timestamp ) -> int : # type: ignore
21442015 """Convert a timestamp to microseconds"""
@@ -2272,11 +2143,6 @@ def str_lstrip_op( # type: ignore[empty-body]
22722143 """Remove leading and trailing characters."""
22732144
22742145
2275- @ibis_udf .scalar .builtin
2276- def st_isclosed (a : ibis_dtypes .geography ) -> ibis_dtypes .boolean : # type: ignore
2277- """Checks if a geography is closed."""
2278-
2279-
22802146@ibis_udf .scalar .builtin (name = "rtrim" )
22812147def str_rstrip_op ( # type: ignore[empty-body]
22822148 x : ibis_dtypes .String , to_strip : ibis_dtypes .String
0 commit comments