Package org.apache.spark.sql.api.java

Examples of org.apache.spark.sql.api.java.JavaSchemaRDD.schemaString()


  @Test
  public void testBasicRead() throws Exception {
    JavaSchemaRDD schemaRDD = artistsAsSchemaRDD();
    assertTrue(schemaRDD.count() > 300);
    schemaRDD.registerTempTable("datfile");
    System.out.println(schemaRDD.schemaString());
    assertEquals(5, schemaRDD.take(5).size());
    JavaSchemaRDD results = sqc
        .sql("SELECT name FROM datfile WHERE id >=1 AND id <=10");
    assertEquals(10, schemaRDD.take(10).size());
  }
View Full Code Here


  public void testEsSchemaRDD2Read() throws Exception {
    String target = "sparksql-test/scala-basic-write";

    JavaSchemaRDD schemaRDD = JavaEsSparkSQL.esRDD(sqc, target);
    assertTrue(schemaRDD.count() > 300);
    String schema = schemaRDD.schemaString();
    assertTrue(schema.contains("id: long"));
    assertTrue(schema.contains("name: string"));
    assertTrue(schema.contains("pictures: string"));
    assertTrue(schema.contains("time: long"));
    assertTrue(schema.contains("url: string"));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.