Github user huitseeker commented on a diff in the pull request:
https://github.com/apache/spark/pull/8103#discussion_r49298081
--- Diff:
streaming/src/main/scala/org/apache/spark/streaming/api/java/JavaPairDStream.scala
---
@@ -336,7 +336,8 @@ class JavaPairDStream[K, V](val dstream: DStream[(K,
V)])(
* However, it is applicable to only "invertible reduce functions".
* Hash partitioning is used to generate the RDDs with Spark's default
number of partitions.
* @param reduceFunc associative reduce function
- * @param invReduceFunc inverse function
+ * @param invReduceFunc inverse function; such that for all x,
invertible y:
+ * `invReduceFunc(reduceFunc(x, y), y) = x`
--- End diff --
```
Welcome to Scala version 2.11.7 (OpenJDK 64-Bit Server VM, Java 1.7.0_91).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def f(s1: String, s2: String) = s1 + s2
f: (s1: String, s2: String)String
scala> def fInv(s1: String, s2: String) = s1.stripSuffix(s2)
fInv: (s1: String, s2: String)String
scala> val x = "aaa"
x: String = aaa
scala> val y = "bbb"
y: String = bbb
scala> fInv(f(x, y), y)
res0: String = aaa
scala> fInv(f(x, y), y) === x
<console>:15: error: value === is not a member of String
fInv(f(x, y), y) === x
^
scala> fInv(f(x, y), y) == x
res2: Boolean = true
scala> fInv(f(x, y), x)
res3: String = aaabbb
scala> fInv(f(x, y), x) === y
<console>:15: error: value === is not a member of String
fInv(f(x, y), x) === y
^
scala> fInv(f(x, y), x) == y
res5: Boolean = false
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]