ST_CreateDuration takes an integer and a temporal unit and returns a duration tuple. The temporal unit can be
milliseconds
, seconds
, minutes
, hours
, or days
. The value must be a short or long integer.
Both the value and unit can be specified as either literal values or columns.
The duration tuple can be used as a track offset to to query and split tracks.
Tracks are linestrings that represent the change in an entity's location over time. Each vertex in the linestring has a timestamp (stored as the M-value) and the vertices are ordered sequentially.
For more information on using tracks in GeoAnalytics for Microsoft Fabric, see the core concept topic on tracks.
Function | Syntax |
---|---|
Python | create |
SQL | ST |
Scala | create |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for create_duration.
Examples
from geoanalytics_fabric.sql import functions as ST
data = [(55, "seconds"),(7, "minutes"),(82, "seconds")]
spark.createDataFrame(data, ["value", "units"]) \
.select(ST.create_duration("value", "units").alias("create_duration")) \
.show(truncate=False)
+---------------+
|create_duration|
+---------------+
|{55, second} |
|{7, minute} |
|{82, second} |
+---------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |