本文整理汇总了Scala中org.apache.spark.annotation.Experimental类的典型用法代码示例。如果您正苦于以下问题:Scala Experimental类的具体用法?Scala Experimental怎么用?Scala Experimental使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Experimental类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: GeoTrellisDataSource
//设置package包名称以及导入依赖的类
package org.apache.spark.sql.gt.sources
import org.apache.spark.sql._
import org.apache.spark.sql.sources._
import java.net.URI
import geotrellis.spark._
import geotrellis.vector.Extent
import org.apache.spark.annotation.Experimental
@Experimental
class GeoTrellisDataSource extends DataSourceRegister with RelationProvider {
def shortName(): String = "geotrellis"
def createRelation(sqlContext: SQLContext, parameters: Map[String, String]): BaseRelation = {
require(parameters.contains("uri"), "'uri' parameter for catalog location required.")
require(parameters.contains("layer"), "'layer' parameter for raster layer name required.")
require(parameters.contains("zoom"), "'zoom' parameter for raster layer zoom level required.")
gt.gtRegister(sqlContext)
val uri: URI = URI.create(parameters("uri"))
val layerId: LayerId = LayerId(parameters("layer"), parameters("zoom").toInt)
val bbox: Option[Extent] = parameters.get("bbox").map(Extent.fromString)
// here would be the place to read the layer metadata
// and dispatch based on key type to spatial or spacetime relation
GeoTrellisRelation(sqlContext, uri, layerId, bbox)
}
}