[jira] [Commented] (IGNITE-2216) Duplicate field names with aliases do not work in queries.

2017-02-16 Thread Vladimir Ozerov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-2216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15869875#comment-15869875
 ] 

Vladimir Ozerov commented on IGNITE-2216:
-

Moving to 2.0 because ticket must be reviewed carefully from usability 
standpoint.

> Duplicate field names with aliases do not work in queries.
> --
>
> Key: IGNITE-2216
> URL: https://issues.apache.org/jira/browse/IGNITE-2216
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, SQL
>Affects Versions: ignite-1.4
>Reporter: Vladimir Ozerov
>Assignee: Sergey Kalashnikov
> Fix For: 2.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (IGNITE-2216) Duplicate field names with aliases do not work in queries.

2017-01-23 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-2216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15834755#comment-15834755
 ] 

ASF GitHub Bot commented on IGNITE-2216:


GitHub user skalashnikov opened a pull request:

https://github.com/apache/ignite/pull/1455

IGNITE-2216: Added support for query fields disambiguation



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/gridgain/apache-ignite ignite-2216

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/ignite/pull/1455.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1455


commit 3dc30669b0e2e644ddf2aba3e80a2d2aab175db2
Author: skalashnikov 
Date:   2017-01-18T16:45:51Z

IGNITE-2216: Added reproducer sample code

commit be2ef9d9057d1ec4bd62cd475f2752109dee4f72
Author: skalashnikov 
Date:   2017-01-19T17:15:05Z

IGNITE-2216: draft fix which barely pass the test

commit 771e1730e6e913b91119b5af7ac309708cc88c52
Author: skalashnikov 
Date:   2017-01-23T15:27:20Z

IGNITE-2216: adding prefix only for field of superclass




> Duplicate field names with aliases do not work in queries.
> --
>
> Key: IGNITE-2216
> URL: https://issues.apache.org/jira/browse/IGNITE-2216
> Project: Ignite
>  Issue Type: Bug
>  Components: cache, SQL
>Affects Versions: ignite-1.4
>Reporter: Vladimir Ozerov
>Assignee: Sergey Kalashnikov
> Fix For: 1.9
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-2216) Duplicate field names with aliases do not work in queries.

2015-12-22 Thread Vladimir Ozerov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-2216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15067742#comment-15067742
 ] 

Vladimir Ozerov commented on IGNITE-2216:
-

Appears to be pretty complex fix. Moving to 1.6.

> Duplicate field names with aliases do not work in queries.
> --
>
> Key: IGNITE-2216
> URL: https://issues.apache.org/jira/browse/IGNITE-2216
> Project: Ignite
>  Issue Type: Bug
>  Components: cache
>Affects Versions: ignite-1.4
>Reporter: Vladimir Ozerov
>Assignee: Vladimir Ozerov
>Priority: Critical
> Fix For: 1.6
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IGNITE-2216) Duplicate field names with aliases do not work in queries.

2015-12-21 Thread Vladimir Ozerov (JIRA)

[ 
https://issues.apache.org/jira/browse/IGNITE-2216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15066363#comment-15066363
 ] 

Vladimir Ozerov commented on IGNITE-2216:
-

Sample test reproducing the issue. It fails with both OptimziedMarshaller and 
BinaryMarshaller.

{code}
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.ignite.internal.processors.cache;

import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.binary.BinaryMarshaller;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.marshaller.optimized.OptimizedMarshaller;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;

import javax.cache.Cache;
import java.util.Iterator;
import java.util.List;

/**
 * Tests for class with duplicate field names and aliases on them.
 */
public class BinaryDuplicateFieldsWithAliasQuerySelfTest extends 
GridCommonAbstractTest {
/** Field 1. */
private static final String FIELD_1 = "x1";

/** Field 2. */
private static final String FIELD_2 = "x2";

/** Ignite instance. */
private Ignite ignite;

/** Cache. */
private IgniteCache cache;

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected void beforeTest() throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();

cfg.setLocalHost("127.0.0.1");

TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);

//cfg.setMarshaller(new BinaryMarshaller());
cfg.setMarshaller(new OptimizedMarshaller());

CacheConfiguration cacheCfg = new CacheConfiguration();

cacheCfg.setName(null);
cacheCfg.setCacheMode(CacheMode.PARTITIONED);
cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);

cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC);

cacheCfg.setIndexedTypes(Integer.class, Entity2.class);

cfg.setCacheConfiguration(cacheCfg);

ignite = Ignition.start(cfg);

cache = ignite.cache(null);
}

/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
G.stopAll(true);

ignite = null;
cache = null;
}

/**
 * Test duplicate fields querying.
 *
 * @throws Exception If failed.
 */
@SuppressWarnings("unchecked")
public void testDuplicateFields() throws Exception {
cache.put(1, new Entity2(10, 11));
cache.put(2, new Entity2(20, 21));
cache.put(3, new Entity2(30, 31));

// Test first field.
Iterator iter = cache.query(new SqlQuery(Entity2.class, FIELD_1 + 
"=20")).iterator();

assert iter.hasNext();

Cache.Entry res = (Cache.Entry)iter.next();

assertEquals(2, (int)res.getKey());
assertEquals(20, res.getValue().get1());
assertEquals(21, res.getValue().get2());

assert !iter.hasNext();

// Test second field.
iter = cache.query(new SqlQuery(Entity2.class, FIELD_2 + 
"=21")).iterator();

assert iter.hasNext();

res = (Cache.Entry)iter.next();

assertEquals(2, (int)res.getKey());
assertEquals(20, res.getValue().get1());
assertEquals(21, res.getValue().get2());

assert !iter.hasNext();

iter = ca