Package org.apache.spark.sql.types
Class GeographyType
Object
org.apache.spark.sql.types.DataType
org.apache.spark.sql.types.GeographyType
- All Implemented Interfaces:
Serializable
The data type representing GEOGRAPHY values which are spatial objects, as defined in the Open
Geospatial Consortium (OGC) Simple Feature Access specification
(https://portal.ogc.org/files/?artifact_id=25355), with a geographic coordinate system.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe GeographyType with mixed SRID can accept any other GeographyType, i.e.static GeographyTypeapply(int srid) Constructors for GeographyType.static GeographyTypestatic GeographyTypestatic GeographyTypeapply(String crs, EdgeInterpolationAlgorithm algorithm) crs()intThe default size of a value of the GeographyType is 2048 bytes, which can store roughly 120 2D points.booleanTwo types are considered equal iff they are both GeographyTypes and have the same type info.static final EdgeInterpolationAlgorithm.SPHERICAL$static final Stringstatic final Stringstatic final intDefault CRS value for GeographyType depends on storage specification.inthashCode()The hash code of the GeographyType is derived from its SRID value.booleanThe GeographyType is a mixed SRID type iff the SRID is MIXED_SRID.static booleanisSridSupported(int srid) Returns whether the given SRID is supported.org.json4s.JValueJSON representation of the GeographyType, which uses the CRS string and edge interpolation algorithm string, in line with the current storage specifications (e.g.static final Stringstatic final intintsrid()Spatial Reference Identifier (SRID) value of the geography type.toString()String representation of the GeographyType, which uses SRID for fixed SRID types and "ANY" for mixed SRID types, providing a clear and concise user-friendly format for this type.typeName()Type name that is displayed to users.Methods inherited from class org.apache.spark.sql.types.DataType
catalogString, COLLATIONS_METADATA_KEY, equalsIgnoreCaseAndNullability, equalsIgnoreNullability, equalsStructurally, equalsStructurallyByName, fromDDL, fromJson, json, parseTypeWithFallback, prettyJson, simpleString, sql
-
Constructor Details
-
GeographyType
public GeographyType()
-
-
Method Details
-
MIXED_SRID
public static final int MIXED_SRID() -
MIXED_CRS
-
GEOGRAPHY_DEFAULT_SRID
public static final int GEOGRAPHY_DEFAULT_SRID()Default CRS value for GeographyType depends on storage specification. Parquet and Iceberg use OGC:CRS84, which translates to SRID 4326 here.- Returns:
- (undocumented)
-
GEOGRAPHY_DEFAULT_CRS
-
GEOGRAPHY_DEFAULT_ALGORITHM
-
GEOGRAPHY_DEFAULT_EPSG_CRS
-
isSridSupported
public static boolean isSridSupported(int srid) Returns whether the given SRID is supported. -
apply
Constructors for GeographyType.- Parameters:
srid- (undocumented)- Returns:
- (undocumented)
-
apply
-
apply
-
apply
-
crs
-
algorithm
-
srid
public int srid()Spatial Reference Identifier (SRID) value of the geography type.- Returns:
- (undocumented)
-
defaultSize
public int defaultSize()The default size of a value of the GeographyType is 2048 bytes, which can store roughly 120 2D points.- Specified by:
defaultSizein classDataType- Returns:
- (undocumented)
-
isMixedSrid
public boolean isMixedSrid()The GeographyType is a mixed SRID type iff the SRID is MIXED_SRID. Semantically, this means that different SRID values per row are allowed.- Returns:
- (undocumented)
-
typeName
Type name that is displayed to users. -
toString
String representation of the GeographyType, which uses SRID for fixed SRID types and "ANY" for mixed SRID types, providing a clear and concise user-friendly format for this type. -
jsonValue
public org.json4s.JValue jsonValue()JSON representation of the GeographyType, which uses the CRS string and edge interpolation algorithm string, in line with the current storage specifications (e.g. Parquet, Delta, Iceberg). Note that mixed SRID is disallowed, and only fixed SRID types can be stored. This is also in accordance to storage formats.- Returns:
- (undocumented)
-
equals
Two types are considered equal iff they are both GeographyTypes and have the same type info. For the GEOGRAPHY type, the SRID value and algorithm uniquely identify its type information. -
hashCode
public int hashCode()The hash code of the GeographyType is derived from its SRID value. -
acceptsGeographyType
The GeographyType with mixed SRID can accept any other GeographyType, i.e. either a fixed SRID GeographyType or another mixed SRID GeographyType. Conversely, a GeographyType with fixed SRID can only accept another GeographyType with the same fixed SRID value, and not a mixed SRID.- Parameters:
gt- (undocumented)- Returns:
- (undocumented)
-