cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Petrov (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (CASSANDRA-12128) Unexpected amount of returned results after querying SASI index
Date Sun, 03 Jul 2016 19:08:11 GMT

     [ https://issues.apache.org/jira/browse/CASSANDRA-12128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alex Petrov resolved CASSANDRA-12128.
-------------------------------------
    Resolution: Invalid

> Unexpected amount of returned results after querying SASI index
> ---------------------------------------------------------------
>
>                 Key: CASSANDRA-12128
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12128
>             Project: Cassandra
>          Issue Type: Bug
>            Reporter: Alex Petrov
>
> I'm working on [CASSANDRA-11990] and one of the unit tests started failing after the
changes I've made. However, it seems that the results returned on {{trunk}} are incorrect.

> One can reproduce it with the following code:
> {code}
>     @Test
>     public void testCrossSSTableQueries2() throws Exception
>     {
>         Map<String, Pair<String, Integer>> part1 = new HashMap<String,
Pair<String, Integer>>()
>         {{
>             put("key0", Pair.create("Maxie", 43));
>             put("key1", Pair.create("Chelsie", 33));
>             put("key2", Pair.create("Josephine", 43));
>             put("key3", Pair.create("Shanna", 27));
>             put("key4", Pair.create("Amiya", 36));
>         }};
>         loadData(part1, true); // first sstable
>         Map<String, Pair<String, Integer>> part2 = new HashMap<String,
Pair<String, Integer>>()
>         {{
>             put("key5", Pair.create("Americo", 20));
>             put("key6", Pair.create("Fiona", 39));
>             put("key7", Pair.create("Francis", 41));
>             put("key8", Pair.create("Charley", 21));
>             put("key9", Pair.create("Amely", 40));
>         }};
>         loadData(part2, true);
>         Map<String, Pair<String, Integer>> part3 = new HashMap<String,
Pair<String, Integer>>()
>         {{
>             put("key10", Pair.create("Eddie", 42));
>             put("key11", Pair.create("Oswaldo", 35));
>             put("key12", Pair.create("Susana", 35));
>             put("key13", Pair.create("Alivia", 42));
>             put("key14", Pair.create("Demario", 28));
>         }};
>         ColumnFamilyStore store = loadData(part3, true);
>         final ByteBuffer firstName = UTF8Type.instance.decompose("first_name");
>         Set<String> rows;
>         rows = getIndexed(store, 10,
>                           buildExpression(firstName, Operator.LIKE_SUFFIX, UTF8Type.instance.decompose("a")));
>         Map<String, Pair<String, Integer>> concat = new HashMap<>();
>         concat.putAll(part1);
>         concat.putAll(part2);
>         concat.putAll(part3);
>         Set<String> keys = new HashSet<>();
>         concat.forEach((k, v) -> {
>             int idx = v.left.indexOf('a');
>             if (idx > 0)
>             {
>                 keys.add(k);
>             }
>         });
>         System.out.println("keys = " + keys);
>         String[] arr = new String[keys.size()];
>         keys.toArray(arr);
>         Assert.assertTrue(rows.toString(), Arrays.equals(arr, rows.toArray(new String[rows.size()])));
>     }
> {code}
> Expected results are (emphasis mine)
> {code}
> [key14, key13, key0, key12, key6, key3, key4, key7, key8, key11]
> "key14"  "Dem_a_rio" 
> "key13"  "Alivi_a_" 
> "key0"   "M_a_xie" 
> "key12"  "Sus_a_na" 
> "key6"   "Fion_a_" 
> "key3"   "Sh_a_nna" 
> "key4"   "Amiy_a_" 
> "key7"   "Fr_a_ncis"
> "key8"   "Ch_a_rley" 
> "key11"  "Osw_a_ldo" 
> {code}
> although returned are
> {code}
> [key12, key13, key3, key4, key6]
> {code}
> cc [~xedin] [~doanduyhai] [~beobal] 



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

Mime
View raw message