You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2016/05/04 14:38:44 UTC
[09/15] ignite git commit: Added a test for IGNITE-3077
Added a test for IGNITE-3077
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e78ed8e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e78ed8e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e78ed8e2
Branch: refs/heads/ignite-db-x-10884
Commit: e78ed8e278e36fe293c66b5efdd78801edc6539c
Parents: 9771833
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Fri Apr 29 18:14:46 2016 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Apr 29 18:14:46 2016 -0700
----------------------------------------------------------------------
.../org/apache/ignite/spark/IgniteRDDSpec.scala | 40 +++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e78ed8e2/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
index 071897a..a41839d 100644
--- a/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
+++ b/modules/spark/src/test/scala/org/apache/ignite/spark/IgniteRDDSpec.scala
@@ -17,6 +17,8 @@
package org.apache.ignite.spark
+import java.time.LocalDate
+
import org.apache.ignite.Ignition
import org.apache.ignite.cache.query.annotations.{QueryTextField, QuerySqlField}
import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
@@ -165,6 +167,33 @@ class IgniteRDDSpec extends FunSpec with Matchers with BeforeAndAfterAll with Be
sc.stop()
}
}
+
+ it("should successfully query complex object fields") {
+ assert(false, "https://issues.apache.org/jira/browse/IGNITE-3077")
+
+ val sc = new SparkContext("local[*]", "test")
+
+ try {
+ val ic = new IgniteContext[Integer, WithObjectField](sc,
+ () \u21d2 configuration("client", client = true))
+
+ val cache: IgniteRDD[Integer, WithObjectField] = ic.fromCache(PARTITIONED_CACHE_NAME)
+
+ cache.savePairs(sc.parallelize(0 to 1000, 2).map(i \u21d2 (i:java.lang.Integer, new WithObjectField(i, new Entity(i, "", i)))))
+
+ val df = cache.sql("select i, ts from WithLocalDate where i = ?", 50)
+
+ df.printSchema()
+
+ val res = df.collect()
+
+ assert(res.length == 1, "Invalid result length")
+ assert(50 == res(0)(0), "Invalid result")
+ }
+ finally {
+ sc.stop()
+ }
+ }
}
override protected def beforeEach() = {
@@ -188,6 +217,12 @@ class IgniteRDDSpec extends FunSpec with Matchers with BeforeAndAfterAll with Be
}
}
+case class WithObjectField(
+ @(QuerySqlField @field)(index = true) val i : Int,
+ @(QuerySqlField @field)(index = false) val ts : Object
+) {
+}
+
/**
* Constants and utility methods.
*/
@@ -242,7 +277,10 @@ object IgniteRDDSpec {
ccfg.setName(PARTITIONED_CACHE_NAME)
- ccfg.setIndexedTypes(classOf[String], classOf[Entity])
+ ccfg.setIndexedTypes(
+ classOf[String], classOf[Entity],
+ classOf[Integer], classOf[WithObjectField]
+ )
ccfg
}