spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kyunam Kim <kyunam_...@hotmail.com>
Subject how to call database specific function when reading writing thru jdbc
Date Fri, 08 Jun 2018 01:08:05 GMT
For example, in SQL Server, when reading, I want to call a built-in function: STAsText()

SELECT id, shape.STAsText() FROM SpatialTable

val df = _sparkSession
        .read
        .jdbc(url, "dbo.SpatialTable", props)
        .select("shape.STAsText()")  // No, this doesn't work.
        .as("shape")

Also when writing, I want to be able to call a built-in function: STGeomFromText like this:
INSERT INTO SpatialTable (GeomCol1) VALUES (geometry::STGeomFromText('POLYGON ((0 0, 150 0,
150 150, 0 150, 0 0))', 0));

How would go about doing this?

Thanks,
Kyunam

Mime
View raw message