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 0CED7200C1E for ; Fri, 17 Feb 2017 19:16:27 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0B6E3160B57; Fri, 17 Feb 2017 18:16:27 +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 531B8160B46 for ; Fri, 17 Feb 2017 19:16:26 +0100 (CET) Received: (qmail 30100 invoked by uid 500); 17 Feb 2017 18:16:25 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 30084 invoked by uid 99); 17 Feb 2017 18:16:25 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2017 18:16:25 +0000 Received: from mail-qk0-f172.google.com (mail-qk0-f172.google.com [209.85.220.172]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 3524F1A00A2 for ; Fri, 17 Feb 2017 18:16:25 +0000 (UTC) Received: by mail-qk0-f172.google.com with SMTP id 11so50933339qkl.3 for ; Fri, 17 Feb 2017 10:16:25 -0800 (PST) X-Gm-Message-State: AMke39nDUlYhLcNWcl27l+E0Ms4RcNGO3XH20u6PaNuaIvu15sZ/gp77dJlpD2Sa2CjZan3oscIvHX5OHIjnQWk4 X-Received: by 10.55.166.10 with SMTP id p10mr6336733qke.100.1487355384146; Fri, 17 Feb 2017 10:16:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.62.133 with HTTP; Fri, 17 Feb 2017 10:15:43 -0800 (PST) In-Reply-To: References: From: Dmitriy Setrakyan Date: Fri, 17 Feb 2017 10:15:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: DML usability: routing single column to several object fields To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a114fd56c5405b90548bde94e archived-at: Fri, 17 Feb 2017 18:16:27 -0000 --001a114fd56c5405b90548bde94e Content-Type: text/plain; charset=UTF-8 Vladimir, Still not clear. Why not create a proper mapping of a table attribute to a key? If we don't support it today, do you think it will be feasible to add such support? D. On Fri, Feb 17, 2017 at 12:25 AM, Vladimir Ozerov wrote: > Dima, > > I am not sure we are talking about the same thing. My point is that > currently single value is often mapped to several values in cache key-value > pair. This is done for usability reasons, and the question is how to > continue supporting this approach with DML. Let me show the problem again, > consider the following value class: > > This is how users often work with Ignite: > > class Person { > long id; > String name; > } > > IgniteCache cache = ...; > > Person getById(long id) { > return cache.get(id); > } > > DML doesn't support this approach at the moment, because we cannot map > single attribute from DML statement to multiple destinations in key-value > pair (_key + _val.Person.id). For this reason users will have to redefine > their schema and do the following: > > IgniteCache cache = ...; > > Person getById(long id) { > return new Person(id, cache.get(id)); > } > > Only [DML + cache API] interaction is affected. No problems with [DML + > SELECT] usages. > > > On Thu, Feb 16, 2017 at 11:27 PM, Dmitriy Setrakyan > > wrote: > > > Vladimir, > > > > When a table is created, user should specify the "primary key". We can > > extract this field and use it as the key into the BTree index. This way > it > > will fit into the current design. Am I wrong? > > > > D. > > > > On Thu, Feb 16, 2017 at 4:33 AM, Vladimir Ozerov > > wrote: > > > > > Igniters, > > > > > > Consider the following pattern which is typically used by users when > > > working through cache API and quering data through SQL at the same > time: > > > > > > class Person { > > > @QuerySqlField > > > long id; > > > > > > @QuerySqlField > > > String name; > > > } > > > > > > cache.put(*id*, new Person(*id*, name)); > > > > > > SELECT *id*, name FROM person; > > > > > > Notice that ID is stored twice per cache record - once for key, and > once > > > for value. This pattern is very convenient for users - loose some > little > > > space due to duplication on the one hand, but have self-contained value > > > with all necessary data on the other. In fact virtually all production > > > systems I saw followed this approach and had some minor duplication. > > > > > > It seems this approach doesn't work well with DML and upcoming DDL. > When > > > executing INSERT INTO Person VALUES (:id, :name), I specify two > > attributes > > > which must update three cache fields. > > > > > > In order to preserve usability of native cache API when DML is > involved, > > we > > > need ability to map certain attribute to several Object properties. > > > Probably this can be achieved with additional field property which > > defines > > > that it belongs to a group mapped to an attribute. May be existing > > aliases > > > could be used for this. > > > > > > Or we can ignore the problem sacrificing cache API usability a bit in > > case > > > of DML/DDL > > > > > > Any ideas on whether we need it, and how to design public API? > > > > > > Vladimir. > > > > > > --001a114fd56c5405b90548bde94e--