Return-Path: X-Original-To: apmail-accumulo-notifications-archive@minotaur.apache.org Delivered-To: apmail-accumulo-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 7F3A41768E for ; Sat, 11 Apr 2015 19:22:12 +0000 (UTC) Received: (qmail 54148 invoked by uid 500); 11 Apr 2015 19:22:12 -0000 Delivered-To: apmail-accumulo-notifications-archive@accumulo.apache.org Received: (qmail 54111 invoked by uid 500); 11 Apr 2015 19:22:12 -0000 Mailing-List: contact notifications-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jira@apache.org Delivered-To: mailing list notifications@accumulo.apache.org Received: (qmail 54100 invoked by uid 99); 11 Apr 2015 19:22:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Apr 2015 19:22:12 +0000 Date: Sat, 11 Apr 2015 19:22:12 +0000 (UTC) From: "William Slacum (JIRA)" To: notifications@accumulo.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ACCUMULO-3718) not possible to create a Mutation object from scala w/o some extra helper code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/ACCUMULO-3718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14491164#comment-14491164 ] William Slacum commented on ACCUMULO-3718: ------------------------------------------ Good point. A copy will be made if the Mutation is *not* serialized and one of: # {{Mutation#toString}} # {{Mutation#hashCode}} # {{Mutation#toThrift(false)}} is called. I did some cursory grepping and don't see where this would happen besides a {{Set}} in Tablet (in 1.5) when checking constraints. I'll re-open this issue to alleviate this concerns. > not possible to create a Mutation object from scala w/o some extra helper code > ------------------------------------------------------------------------------ > > Key: ACCUMULO-3718 > URL: https://issues.apache.org/jira/browse/ACCUMULO-3718 > Project: Accumulo > Issue Type: Bug > Affects Versions: 1.5.2, 1.6.2 > Reporter: David Holiday > Assignee: William Slacum > Priority: Blocker > Fix For: 1.5.3, 1.7.0, 1.6.3 > > Time Spent: 0.5h > Remaining Estimate: 0h > > issue: > it's not possible to create a Mutation object from scala without employing a standalone java jar wrapper. the preferred method for creating the object has you do it in two stages: create with table row, then employ Mutation.put() to populate the object with the actual mutation data. when you do this in scala, you get a > java.lang.IllegalStateException: Can not add to mutation after serializing it at org.apache.accumulo.core.data.Mutation.put(Mutation.java:168) at org.apache.accumulo.core.data.Mutation.put(Mutation.java:163) at org.apache.accumulo.core.data.Mutation.put(Mutation.java:211) > error. I *think* this has something to do with the byte array going out of scope in Scala but somehow not in Java. If you concat the operations (constuctor().put(data, data, ...) you don't run into the error, but scala sees a Unit return type, so you can't actually add the mutation to a BatchWriter. The only way I was able to get around this was to create a stand-alone jar with a method that created then returned a populated mutation object. > I wasn't sure whether or not to call this a bug or an enhancement. given that you probably want Accumulo to play nice with Scala I decided to call it a bug. > below is a link to the stack overflow thread I created whilst figuring all this out: > http://stackoverflow.com/questions/29497547/odd-error-when-populating-accumulo-1-6-mutation-object-via-spark-notebook/29527189#29527189 -- This message was sent by Atlassian JIRA (v6.3.4#6332)