-
Notifications
You must be signed in to change notification settings - Fork 772
Closed
Description
Repro code
public class Program
{
public static void Main(string[] args)
{
var customers = new List<Customer>
{
new Customer {CustomerId = "ALFKI"},
new Customer {CustomerId = "ANANT"},
new Customer {CustomerId = "FISSA"}
};
var orders = new List<Order>
{
new Order { OrderId = 1, CustomerId = "ALFKI"},
new Order { OrderId = 2, CustomerId = "ALFKI"},
new Order { OrderId = 3, CustomerId = "ALFKI"},
new Order { OrderId = 4, CustomerId = "FISSA"},
new Order { OrderId = 5, CustomerId = "FISSA"},
new Order { OrderId = 6, CustomerId = "FISSA"},
};
var syncResult = customers.Join(orders, c => c.CustomerId, o => o.CustomerId,
(c, o) => new {c.CustomerId, o.OrderId});
var asyncResult = customers.ToAsyncEnumerable().Join(orders.ToAsyncEnumerable(), c => c.CustomerId, o => o.CustomerId,
(c, o) => new { c.CustomerId, o.OrderId });
Console.WriteLine("Sync results");
foreach (var pair in syncResult)
{
Console.WriteLine(pair.CustomerId + " " + pair.OrderId);
}
Console.WriteLine("");
Console.WriteLine("Async results");
using (var enumerator = asyncResult.GetEnumerator())
{
while (enumerator.MoveNext().Result)
{
Console.WriteLine(enumerator.Current.CustomerId + " " + enumerator.Current.OrderId);
}
}
}
}
public class Customer
{
public string CustomerId { get; set; }
}
public class Order
{
public int OrderId { get; set; }
public string CustomerId { get; set; }
}
Output:
Sync results
ALFKI 1
ALFKI 2
ALFKI 3
FISSA 4
FISSA 5
FISSA 6
Async results
ALFKI 1
ALFKI 2
ALFKI 3
Version info : System.Interactive.Async
- 3.1.0-rc
Issue details:
Async join operator terminates if the key in outer does not match with any key in inner. Enumerable
version skips of such key and return results from rest of keys.