From user-return-16-archive-asf-public=cust-asf.ponee.io@arrow.apache.org Wed Oct 3 22:22:40 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 6D1B318065B for ; Wed, 3 Oct 2018 22:22:40 +0200 (CEST) Received: (qmail 49180 invoked by uid 500); 3 Oct 2018 20:22:39 -0000 Mailing-List: contact user-help@arrow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@arrow.apache.org Delivered-To: mailing list user@arrow.apache.org Received: (qmail 49170 invoked by uid 99); 3 Oct 2018 20:22:39 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2018 20:22:39 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 29D62C1BA9 for ; Wed, 3 Oct 2018 20:22:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.103 X-Spam-Level: X-Spam-Status: No, score=-0.103 tagged_above=-999 required=6.31 tests=[DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id Z2hMb7CbJ_Fw for ; Wed, 3 Oct 2018 20:22:36 +0000 (UTC) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id ED8ED5F56F for ; Wed, 3 Oct 2018 20:22:35 +0000 (UTC) Received: by mail-io1-f52.google.com with SMTP id l25-v6so6136685ioj.0 for ; Wed, 03 Oct 2018 13:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=DdE96sNt9+8GmcBU5oS+PKQde42ppv3EXVnR8as57PE=; b=JTIttyAiX+qmsCTysoR/cQah4AdD8qWIWvWEYlLOPiIzGh1NLfCF91PZUMsoE2ysqg 6AqwaPlaOAUVx1rEW0Dx6yM3v9cvGMW1eKYr4vs9jNOy71lTG9xF7vK9EZpZ6EvyMzHO tXvkwob07nK26gln09G/1b69OSKXpu+Bu23eu/Zlpw2PV23RFy3zHNEVcNskOL4uUp1Y aMvYfexfP3UlAs0ZwMJnYYKOOXmHl+GbunEBtG0A64Yjg4VJA90+DCclHWXYrA5ZncGs FV35oe7rol7Qb7RDtuXGXL44BnPQxuP6qzkxn4N4R0yuJ3YCLfv4Xyf/KATYF2eHhYa+ K4OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=DdE96sNt9+8GmcBU5oS+PKQde42ppv3EXVnR8as57PE=; b=e+GGa3v1mxtV8UVvFV9Jcn3k/cQsvq1GKqDVEHoytXbwwUiIyHJ1ScI3o7ymXdCOoF Pur3gv+w+0Df7kTMGGIBIFba0VFlKNGzntlCAaBmg/EtXfoQ4FXhfRSXNonVSNPF+lxw zMmkOnxE/8Mc8nJDnWtlfHXUNFwO9vhK6tEaCYD/g8Lm9hXwk4N8JLxgNPJIKhrZohjZ G4kxVeaIzkrAt4WlOuf84I87GC40yb9DPUcION/vQxaSK7m3aMdil8qqbbNW5g+nBx/w pMXbBKXGPRRckePVeW2drlkdUAyXHV+M0pPipaNIVvm1KS98ZDCcMqxyqBx3YIOXREQB OhOA== X-Gm-Message-State: ABuFfoguYbdqRGi68AfJHMGagh5YMWbZncq7waD+31q3N+lYyarZ1u2O Nnx7SlpEDUi9BixCK0LPKUnoI3xeDNyZrtNdpojWjZqn X-Google-Smtp-Source: ACcGV63qedFukasTZL37gHBNxNbXpYo+aftAVU4wQBFpizotstUnUPi6K+1ecmuKhHQ41rqr46g+joCB6eMwUnZYtRA= X-Received: by 2002:a6b:bf04:: with SMTP id p4-v6mr2333841iof.15.1538598148391; Wed, 03 Oct 2018 13:22:28 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Wes McKinney Date: Wed, 3 Oct 2018 16:21:51 -0400 Message-ID: Subject: Re: Help with writing Apache Arrow tables to shared memory. To: user@arrow.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable hi Bipin -- I will reply to your mail on the dev@ mailing list but it may take me some time. I'm traveling internationally to conferences and also have been focused on moving the 0.11 release forward. - Wes On Wed, Oct 3, 2018 at 12:00 PM Bipin Mathew wrote: > > Good Morning Everyone, > > I originally posted this question to the dev channel, not knowing a u= ser channel was available. This channel is more probably more appropriate a= nd I am hoping the kind souls here can help me. How, fundamentally, are we = expected, to copy or indeed directly write a arrow table to shared memory u= sing the cpp sdk? Currently, I have an implementation like this: > >> 77 std::shared_ptr B; >> 78 std::shared_ptr buffer; >> 79 std::shared_ptr writer; >> 80 arrow::MemoryPool* pool =3D arrow::default_memory_pool(); >> 81 arrow::io::BufferOutputStream::Create(4096,pool,&buffer); >> 82 std::shared_ptr table; >> 83 karrow::ArrowHandle *h; >> 84 h =3D (karrow::ArrowHandle *)Kj(khandle); >> 85 table =3D h->table; >> 86 >> 87 arrow::ipc::RecordBatchStreamWriter::Open(buffer.get(),table->sche= ma(),&writer); >> 88 writer->WriteTable(*table); >> 89 writer->Close(); >> 90 buffer->Finish(&B); >> 91 >> 92 // printf("Investigate Memory usage."); >> 93 // getchar(); >> 94 >> 95 >> 96 std::shared_ptr mm; >> 97 arrow::io::MemoryMappedFile::Create("/dev/shm/arrow_table",B->size= (),&mm); >> 98 mm->Write(B->data(),B->size()); >> 99 mm->Close(); > > > "table" on line 85 is a shared_ptr to a arrow::Table object. As you can s= ee there, I write to an arrow:Buffer then write that to a memory mapped fil= e. Is there a more direct approach? I watched this video of a talk @Wes McK= inney gave here: > > https://www.dremio.com/webinars/arrow-c++-roadmap-and-pandas2/ > > Where a method: arrow::MemoryMappedBuffer was referenced, but I have not = seen any documentation regarding this function. Has it been deprecated? > > Also, as I mentioned, "table" up there is a arrow::Table object. I create= it columnwise using various arrow::[type]Builder functions. Is there anywa= y to actually even write the original table directly into shared memory? An= y guidance on the proper way to do these things would be greatly appreciate= d. > > Regards, > > Bipin