diff --git a/csharp/Samples/Microsoft.Spark.CSharp/PairRDDSamples.cs b/csharp/Samples/Microsoft.Spark.CSharp/PairRDDSamples.cs index 22de846..9a56de9 100644 --- a/csharp/Samples/Microsoft.Spark.CSharp/PairRDDSamples.cs +++ b/csharp/Samples/Microsoft.Spark.CSharp/PairRDDSamples.cs @@ -112,7 +112,7 @@ namespace Microsoft.Spark.CSharp.Samples new Tuple("a", 1) }, 2) .CountByKey() - .ToLookup(x => x.Item1); + .ToDictionary(k => k.Item1, v => v.Item2); foreach (var kv in countByKey) Console.WriteLine(kv); diff --git a/csharp/Samples/Microsoft.Spark.CSharp/RDDSamples.cs b/csharp/Samples/Microsoft.Spark.CSharp/RDDSamples.cs index 62477c3..1112a82 100644 --- a/csharp/Samples/Microsoft.Spark.CSharp/RDDSamples.cs +++ b/csharp/Samples/Microsoft.Spark.CSharp/RDDSamples.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using Microsoft.Spark.CSharp.Core; @@ -221,7 +222,10 @@ namespace Microsoft.Spark.CSharp.Samples [Sample] internal static void RDDCountByValueSample() { - var countByValue = SparkCLRSamples.SparkContext.Parallelize(new int[] { 1, 2, 1, 2, 2 }, 2).CountByValue().ToArray(); + var countByValue = SparkCLRSamples.SparkContext.Parallelize(new int[] { 1, 2, 1, 2, 2 }, 2) + .CountByValue() + .ToDictionary(k => k.Item1, v => v.Item2); + foreach (var item in countByValue) Console.WriteLine(item);