According to https://www.geomesa.org/documentation/user/datastores/attributes.html?highlight=types, java.sql.Timestamp is the binding class for a Timestamp type. I am using the following schema:
I am using the following code:
SparkSession spark = SparkSession.builder()
.appName(APP_NAME)
.config("spark.sql.crossJoin.enabled", "true")
.master("local[*]")
.getOrCreate();
SQLTypes.init(spark.sqlContext());
Dataset<Row> df = spark.read()
.format("geomesa")
.options(datastoreParams.getParams())
.option("geomesa.feature", "myfeature")
.load();
df.createOrReplaceTempView("myfeature");
df.explain();
df.printSchema();
The result of this is:
Notice that timestamp is missing. In the source code for org.locationtech.geomesa.spark.GeoMesaSparkSQL, there is this:
private def ad2field(ad: AttributeDescriptor): Option[StructField] = {
import java.{lang => jl}
val dt = ad.getType.getBinding match {
case t if t == classOf[jl.Double] => DataTypes.DoubleType
case t if t == classOf[jl.Float] => DataTypes.FloatType
case t if t == classOf[jl.Integer] => DataTypes.IntegerType
case t if t == classOf[jl.String] => DataTypes.StringType
case t if t == classOf[jl.Boolean] => DataTypes.BooleanType
case t if t == classOf[jl.Long] => DataTypes.LongType
case t if t == classOf[java.util.Date] => DataTypes.TimestampType
case t if t == classOf[org.locationtech.jts.geom.Point] => JTSTypes.PointTypeInstance
case t if t == classOf[org.locationtech.jts.geom.MultiPoint] => JTSTypes.MultiPointTypeInstance
case t if t == classOf[org.locationtech.jts.geom.LineString] => JTSTypes.LineStringTypeInstance
case t if t == classOf[org.locationtech.jts.geom.MultiLineString] => JTSTypes.MultiLineStringTypeInstance
case t if t == classOf[org.locationtech.jts.geom.Polygon] => JTSTypes.PolygonTypeInstance
case t if t == classOf[org.locationtech.jts.geom.MultiPolygon] => JTSTypes.MultipolygonTypeInstance
case t if classOf[Geometry].isAssignableFrom(t) => JTSTypes.GeometryTypeInstance
case _ => null
}
Option(dt).map(StructField(ad.getLocalName, _))
}
java.sql.Timestamp is not listed as an option. |