Skip to content

Commit

Permalink
Add extra test
Browse files Browse the repository at this point in the history
relates #687
  • Loading branch information
costin committed Feb 1, 2016
1 parent 5a90d7b commit 86c55af
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import org.elasticsearch.hadoop.cfg.ConfigurationOptions.ES_RESOURCE
import org.elasticsearch.hadoop.mr.RestUtils
import org.elasticsearch.hadoop.util.TestSettings
import org.elasticsearch.hadoop.util.TestUtils
import org.elasticsearch.spark._
import org.elasticsearch.spark.rdd.EsSpark
import org.elasticsearch.spark.rdd.Metadata.ID
import org.elasticsearch.spark.rdd.Metadata.TTL
Expand Down Expand Up @@ -384,6 +385,21 @@ class AbstractScalaEsScalaSpark(prefix: String, readMetadata: jl.Boolean) extend
println(RestUtils.getMapping(target))
}


@Test
def testEsSparkVsScCount() {
val target = wrapIndex("spark-test/check-counting")
val rawCore = List( Map("colint" -> 1, "colstr" -> "s"),
Map("colint" -> null, "colstr" -> null) )
sc.parallelize(rawCore, 1).saveToEs(target)
val qjson =
"""{"query":{"range":{"colint":{"from":null,"to":"9","include_lower":true,"include_upper":true}}}}"""

val esRDD = EsSpark.esRDD(sc, target, qjson)
val scRDD = sc.esRDD(target, qjson)
assertEquals(esRDD.collect().size, scRDD.collect().size)
}

//@Test
def testLoadJsonFile() {
val target = "lost/id"
Expand Down

0 comments on commit 86c55af

Please sign in to comment.