geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-247) LocalDataSet executeQuery method ignores the parameter buckets
Date Fri, 11 Mar 2016 23:07:06 GMT

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

ASF GitHub Bot commented on GEODE-247:
--------------------------------------

Github user jhuynh1 commented on a diff in the pull request:

    https://github.com/apache/incubator-geode/pull/112#discussion_r55901674
  
    --- Diff: geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryWithBucketParameterIntgTest.java
---
    @@ -0,0 +1,224 @@
    +/*
    + * 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.
    + */
    +/*
    + * QueryWithBucketParameterTest.java
    + * JUnit based test
    + *
    + * Created on April 13, 2005, 2:40 PM
    + */
    +package com.gemstone.gemfire.cache.query;
    +
    +        import static org.junit.Assert.*;
    +
    +        import java.io.Serializable;
    +        import java.util.*;
    +
    +        import org.junit.After;
    +        import org.junit.Before;
    +        import org.junit.Rule;
    +        import org.junit.Test;
    +        import org.junit.experimental.categories.Category;
    +
    +        import com.gemstone.gemfire.cache.*;
    +        import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
    +        import com.gemstone.gemfire.internal.cache.LocalDataSet;
    +        import com.gemstone.gemfire.internal.cache.PartitionedRegion;
    +        import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
    +        import org.junit.rules.ExpectedException;
    +
    +/**
    + * @implNote This test class has been designed to test the query execution using the
LocalDataSet.executeQuery
    + * where one of the parameters passed is the bucket set to be used.
    + * Different variation of hashset variables are passed to the function to check for errors.
    + * Created by nnag on 3/3/16.
    + */
    +@Category(IntegrationTest.class)
    +public class QueryWithBucketParameterIntgTest {
    +
    +    //Necessary data elements required for execution of the test
    +//    Region region;
    +//    QueryService qs;
    +//    Cache cache;
    +    DefaultQuery queryExecutor;
    +    LocalDataSet lds;
    +
    +    /**
    +     * @implNote This code is copied from BugJUnitTest.java. These elements are required
to pass as parameters
    +     * to create data elements for the region
    +     * @implNote This needs to be moved to a common test package to avoid redundant code.
    +     */
    +    static class MyValue implements Serializable, Comparable<MyValue>
    +    {
    +        public int value = 0;
    +
    +        public MyValue(int value) {
    +            this.value = value;
    +        }
    +
    +
    +        public int compareTo(MyValue o)
    +        {
    +            if(this.value > o.value) {
    +                return 1;
    +            }else if(this.value < o.value) {
    +                return -1;
    +            }else {
    +                return 0;
    +            }
    +        }
    +    }
    +
    +    //Empty constructor
    +    public QueryWithBucketParameterIntgTest() {
    +    }
    +
    +    /**
    +     * Pre-test execution to create the test bed.
    +     * This code snippet has been borrowed from (com.gemstone.gemfire.cache.query) BugJUintTest.java
[03/02/2016]
    +     * @throws Exception
    +     */
    +    @Before
    +    public void setUp() throws Exception {
    +        String regionName = "pr1";
    +        int totalBuckets = 40;
    +        int numValues = 80;
    +        CacheUtils.startCache();
    +        Cache cache = CacheUtils.getCache();
    +        PartitionAttributesFactory pAFactory = getPartitionAttributesFactoryWithPartitionResolver(totalBuckets);
    +        RegionFactory rf = cache.createRegionFactory(RegionShortcut.PARTITION);
    +        rf.setPartitionAttributes(pAFactory.create());
    +        PartitionedRegion pr1 = (PartitionedRegion) rf.create(regionName);
    +        populateRegion(pr1, numValues);
    +        QueryService qs = pr1.getCache().getQueryService();
    +        String query = "select distinct e1.value from /pr1 e1";
    +        queryExecutor = (DefaultQuery)CacheUtils.getQueryService().newQuery(
    +                query);
    +        Set<Integer> set = getBucketList(totalBuckets);
    +        lds = new LocalDataSet(pr1, set);
    +    }
    +
    +    private Set<Integer> getBucketList(int nBuckets) {
    --- End diff --
    
    Possibly rename to createBucketList?


> LocalDataSet executeQuery method ignores the parameter buckets
> --------------------------------------------------------------
>
>                 Key: GEODE-247
>                 URL: https://issues.apache.org/jira/browse/GEODE-247
>             Project: Geode
>          Issue Type: Bug
>          Components: querying
>            Reporter: Jason Huynh
>            Assignee: Jason Huynh
>            Priority: Minor
>
> The buckets passes in as a parameter into this call are completely ignored.  It should
probably be used instead of the getBucketSet().
>  public Object executeQuery(DefaultQuery query, Object[] parameters,
>       Set buckets) throws FunctionDomainException,
>       TypeMismatchException, NameResolutionException,
>       QueryInvocationTargetException {
> ...
>  result = this.proxy.executeQuery(query, parameters, getBucketSet());
> ...



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

Mime
View raw message