Skip to content

Instantly share code, notes, and snippets.

@thall
Created January 5, 2018 09:37
Show Gist options
  • Save thall/614b322481c680c996dd8278251f0373 to your computer and use it in GitHub Desktop.
Save thall/614b322481c680c996dd8278251f0373 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>se.purplescout.kuben.spark</groupId>
<artifactId>jobs</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.datasyslab</groupId>
<artifactId>geospark</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.datasyslab</groupId>
<artifactId>geospark-sql_2.1</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<finalName>streaming</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-proc:none</compilerArgument>
<compilerArgument>-Xlint:all</compilerArgument>
<compilerArgument>-Werror</compilerArgument>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
</project>
public class Hello {
public static void main(String... args) throws InterruptedException {
SparkSession session = SparkSession
.builder()
//.master("spark://nixos:7077")
.master("local[*]")
.appName("GeoSpark")
.config("spark.serializer", KryoSerializer.class.getName())
.config("spark.kryo.registrator", GeoSparkKryoRegistrator.class.getName())
.getOrCreate();
SQLContext sqlContext = session.sqlContext();
GeoSparkSQLRegistrator.registerAll(sqlContext);
session.log().info(sqlContext.getAllConfs().toString());
session.catalog().listFunctions().show();
session.log().info(String.valueOf(session.catalog().functionExists("ST_Point")));
GeoSparkConf s = new GeoSparkConf(session.sparkContext().conf());
session.log().info(s.toString());
sqlContext.sql("select st_polygonfromenvelope(1.0,101.0,501.0,601.0)").show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment