[ 
https://issues.apache.org/jira/browse/KAFKA-7301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guozhang Wang updated KAFKA-7301:
---------------------------------
    Fix Version/s: 2.0.1

> KTable to KTable join invocation does not resolve in Scala DSL
> --------------------------------------------------------------
>
>                 Key: KAFKA-7301
>                 URL: https://issues.apache.org/jira/browse/KAFKA-7301
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>    Affects Versions: 2.0.0
>            Reporter: Michal
>            Priority: Major
>              Labels: scala
>             Fix For: 2.0.1, 2.1.0
>
>
> I found a peculiar problem while doing KTable to KTable join using Scala DSL. 
> The following code:
>  
> {code:java}
> val t1: KTable[String, Int] = ...
> val t2: KTable[String, Int] = ...
> val result = t1.join(t2)((x: Int, y: Int) => x + y) 
> {code}
>  
> does not compile with "ambiguous reference to overloaded function". 
> A quick look at the code shows the join functions are defined as follows:
>  
> {code:java}
> def join[VO, VR](other: KTable[K, VO])(
>  joiner: (V, VO) => VR,
>  materialized: Materialized[K, VR, ByteArrayKeyValueStore]
> )
> def join[VO, VR](other: KTable[K, VO])(joiner: (V, VO) => VR)
> {code}
>  
> the reason it does not compile is the fact that the first parameter list is 
> identical. For some peculiar reason the KTable class actually compiles...
> The same problem exists for KTable to KTable leftJoin. Other joins 
> (stream-stream, stream-table) do not seem to be affected as there are no 
> overloaded versions of the functions.
> This can be reproduced in smaller scale by some simple scala code:
>  
> {code:java}
> object F {
>  //def x(a: Int): Int = 5
>  //def x(a: Int): Int = 6 //obviously does not compile
>  def f(x: Int)(y: Int): Int = x
>  def f(x: Int)(y: Int, z: Int): Int = x
> }
> val r = F.f(5)(4) //Cannot resolve
> val r2 = F.f(5)(4, 6) //cannot resolve
> val partial = F.f(5) _ //cannot resolve
> /* you get following error:
> Error: ambiguous reference to overloaded definition,
> both method f in object F of type (x: Int)(y: Int, z: Int)Int
> and method f in object F of type (x: Int)(y: Int)Int
> match argument types (Int)
> */{code}
>  
> The solution: get rid of the multiple parameter lists. I fail to see what 
> practical purpose they serve anyways. I am happy to supply appropriate PR if 
> there is agreement.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to