Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9462B200B54 for ; Thu, 14 Jul 2016 07:33:43 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 92D46160A6E; Thu, 14 Jul 2016 05:33:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D9F50160A6A for ; Thu, 14 Jul 2016 07:33:42 +0200 (CEST) Received: (qmail 85930 invoked by uid 500); 14 Jul 2016 05:33:41 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 85919 invoked by uid 99); 14 Jul 2016 05:33:41 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 05:33:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 14EA8C0C09 for ; Thu, 14 Jul 2016 05:33:41 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.169 X-Spam-Level: * X-Spam-Status: No, score=1.169 tagged_above=-999 required=6.31 tests=[FREEMAIL_ENVFROM_END_DIGIT=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_FAIL=0.919] autolearn=disabled Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id hqhHT1h9dpuh for ; Thu, 14 Jul 2016 05:33:39 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTP id 5075460CEF for ; Thu, 14 Jul 2016 05:33:38 +0000 (UTC) Received: from malf.nabble.com (unknown [162.253.133.59]) by mbob.nabble.com (Postfix) with ESMTP id 3166C2C6D953 for ; Wed, 13 Jul 2016 22:10:52 -0700 (PDT) Date: Wed, 13 Jul 2016 22:16:40 -0700 (PDT) From: November To: user@ignite.apache.org Message-ID: <1468473400118-6299.post@n6.nabble.com> In-Reply-To: <1468461445762-6291.post@n6.nabble.com> References: <1468400302892-6260.post@n6.nabble.com> <1468418647150-6278.post@n6.nabble.com> <1468453981378-6285.post@n6.nabble.com> <1468458908826-6288.post@n6.nabble.com> <1468461445762-6291.post@n6.nabble.com> Subject: Re: How does AffinityKey mapped? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Thu, 14 Jul 2016 05:33:43 -0000 Hi val I come cross a problem while using inner join between two partition caches. The inner join result is incomplete. Following is my code. I use DTermKey as two caches' key. The inner join key is DTerm, So I use [AffinityKeyMapped] on DTermKey.DTerm. Is there any thing wrong? var offerTermCache = ignite.GetOrCreateCache("offerTermCache"); var productTermCache = ignite.GetOrCreateCache("productTermCache"); class DTermKey { private long Id; [AffinityKeyMapped] private string DTerm; public DTermKey(long id, string dTerm) { this.Id = id; this.DTerm = dTerm; } public override bool Equals(object obj) { if (obj == null || !(obj is DTermKey)) { return false; } else { DTermKey other = (DTermKey)obj; return Id == other.Id && DTerm.Equals(other.DTerm); } } public override int GetHashCode() { int hash = 13; hash = (hash * 7) + Id.GetHashCode(); hash = (hash * 7) + DTerm.GetHashCode(); return hash; } public override string ToString() { return "DTermKey [id=" + Id + ", DTerm=" + DTerm + "]"; } } class OfferTerm { [QuerySqlField] public string OfferId { get; set; } [QuerySqlField] public string Title { get; set; } [QuerySqlField(IsIndexed = true)] public string DTerm { get; set; } public OfferTerm(string offerId, string title, string dTerm) { this.OfferId = offerId; this.Title = title; this.DTerm = dTerm; } } class ProductTermCategory { [QuerySqlField(IsIndexed = true)] public string DTerm { get; set; } [QuerySqlField] public double Entropy { get; set; } public ProductTermCategory(string dTerm, double entropy) { this.DTerm = dTerm; this.Entropy = entropy; } } using (var productTermStreamer = ignite.GetDataStreamer(productTermCache.Name)) { using (StreamReader sr = new StreamReader(productTermPath)) { long id = 0; string line; while ((line = sr.ReadLine()) != null) { string[] strs = line.Split('\t'); double entropy = double.Parse(strs[1]); if (entropy <= EntropyThreshold && keywordsCache.ContainsKey(strs[0])) { productTermStreamer.AddData(new DTermKey(id++, strs[0]), new ProductTermCategory(strs[0], entropy)); } } productTermStreamer.Flush(); } } id = 0; var sql = new SqlFieldsQuery("select distinct OfferId, Title, NormalizedStemmed from OfferFeed"); var queryResult = offerFeedCache.QueryFields(sql); foreach (var fields in queryResult) { offerTermCache.Put(new DTermKey(id++, (string)fields[2]), new OfferTerm((string)fields[0], (string)fields[1], (string)fields[2])); } ignite.DestroyCache(offerFeedCache.Name); var joinSql = new SqlFieldsQuery( "select OfferTerm.OfferId, OfferTerm.Title, ProductTermCategory.DTerm, ProductTermCategory.Entropy " + "from OfferTerm, \"productTermCache\".ProductTermCategory where OfferTerm.DTerm = ProductTermCategory.DTerm"); using (StreamWriter sw = new StreamWriter(output)) { foreach (var fields in offerTermCache.QueryFields(joinSql)) { sw.WriteLine("{0}\t{1}\t{2}\t{3}", fields[0], fields[1], fields[2], fields[3]); } } -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-does-AffinityKey-mapped-tp6260p6299.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.