Return-Path: X-Original-To: apmail-asterixdb-notifications-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BECB9189C8 for ; Thu, 19 Nov 2015 21:24:43 +0000 (UTC) Received: (qmail 31394 invoked by uid 500); 19 Nov 2015 21:24:43 -0000 Delivered-To: apmail-asterixdb-notifications-archive@asterixdb.apache.org Received: (qmail 31362 invoked by uid 500); 19 Nov 2015 21:24:43 -0000 Mailing-List: contact notifications-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list notifications@asterixdb.incubator.apache.org Received: (qmail 31353 invoked by uid 99); 19 Nov 2015 21:24:43 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 21:24:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 228FA180AA8 for ; Thu, 19 Nov 2015 21:24:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=6.31 tests=[URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id hSIFmOdArxuH for ; Thu, 19 Nov 2015 21:24:30 +0000 (UTC) Received: from unhygienix.ics.uci.edu (unhygienix.ics.uci.edu [128.195.14.130]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 2D22C43AFF for ; Thu, 19 Nov 2015 21:24:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by unhygienix.ics.uci.edu (Postfix) with ESMTP id B31C7240D73; Thu, 19 Nov 2015 13:21:21 -0800 (PST) Date: Thu, 19 Nov 2015 13:21:21 -0800 From: "Yingyi Bu (Code Review)" To: Heri Ramampiaro CC: Steven Jacobs , Preston Carman , Ian Maxon , Jenkins , Till Westmann Reply-To: buyingyi@gmail.com X-Gerrit-MessageType: comment Subject: Change in asterixdb[master]: Internal functions for record manipulation, deep equality co... X-Gerrit-Change-Id: I3621ebdd71c7cd91b50d77a972ad863cea7fcbc2 X-Gerrit-ChangeURL: X-Gerrit-Commit: 4e4233dc78dc44f2c3fb6508391cdb8e363d917f In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.8.4 Message-Id: <20151119212121.B31C7240D73@unhygienix.ics.uci.edu> Yingyi Bu has posted comments on this change. Change subject: Internal functions for record manipulation, deep equality comparison and fix for ASTERIXDB-1162 ...................................................................... Patch Set 12: (11 comments) Please format the code according to: https://asterixdb.incubator.apache.org/dev-setup.html I found a number of files that do not follow the code format style (if my Eclipse works correctly...). https://asterix-gerrit.ics.uci.edu/#/c/298/12/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitorUtils.java File asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/DeepEqualityVisitorUtils.java: Line 29: public class DeepEqualityVisitorUtils { Race conditions --- because of the usage of shared static states. https://asterix-gerrit.ics.uci.edu/#/c/298/12/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/ListDeepEqualityAccessor.java File asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/ListDeepEqualityAccessor.java: Line 81: Pair arg = new Pair(item1, false); avoid per-tuple object creation overhead. Line 95: } just call "item0.accept(visitor, arg);" ? Line 105: ATypeTag fieldType0 = PointableUtils.getTypeTag(itemTagTypes0.get(i)); just call itemTagTypes0.get(i).accept(itemTagTypes1.get(i)) The visitor pattern allows you to let a "compare" implementation just focuses on the current level, and call visitor.accept(...) for the next level. https://asterix-gerrit.ics.uci.edu/#/c/298/12/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/RecordDeepEqualityAccessor.java File asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/visitors/RecordDeepEqualityAccessor.java: Line 35: class RecordDeepEqualityAccessor { Accessor->Checker? "Accessor" seems a bit misleading. Line 69: if (s0 != s1) wrap if-else branches with {}. That makes code more readable. Line 77: BinaryHashMap.BinaryEntry entry = hashMap.put(keyEntry, valEntry); entry is not used so remove it. Line 99: int index0 = IntegerPointable.getInteger(entry.buf, entry.off); the getInteger seems not needed. Instead, you probably can use: AInt32SerializerDeserializer.getInt() Line 101: if(fieldType0 != PointableUtils.getTypeTag(fieldTypes1.get(index1))) { just call fieldTypes0.get(index0).accept(fieldTypes1.get(index1), ...),to leverage the visitor pattern? BTW, variables could be named in a better way, e.g., 0-->"Left", 1-->"Right". Line 105: arg = new Pair(fieldValues1.get(index1), false); avoid per-tuple object creation. ARecordCaster could be a sample to look at. Line 119: } Just call call "fieldValues0.get(index0).accept(visitor, arg);"? the visitor will do double-dispatch and make the code simpler. -- To view, visit https://asterix-gerrit.ics.uci.edu/298 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: comment Gerrit-Change-Id: I3621ebdd71c7cd91b50d77a972ad863cea7fcbc2 Gerrit-PatchSet: 12 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Heri Ramampiaro Gerrit-Reviewer: Heri Ramampiaro Gerrit-Reviewer: Ian Maxon Gerrit-Reviewer: Jenkins Gerrit-Reviewer: Preston Carman Gerrit-Reviewer: Steven Jacobs Gerrit-Reviewer: Till Westmann Gerrit-Reviewer: Yingyi Bu Gerrit-HasComments: Yes