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

Cesare Cugnasco commented on CASSANDRA-4468:
--------------------------------------------

This is a real interesting feature but actually I fear it couldn't help me. 
In the code I developed I insert in the same CF more 'maps' which use different 
types of data as key. 
This was the reason for using dynamic CT. 

The problem of this approach is that when I insert a single string wrapped in a 
DCT as column name, after it is no possible to retrieve it. 
                
> Temporally unreachable Dynamic Composite column names.
> ------------------------------------------------------
>
>                 Key: CASSANDRA-4468
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4468
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.1.0, 1.1.1, 1.1.2
>         Environment: linux, 
>            Reporter: Cesare Cugnasco
>            Priority: Minor
>              Labels: persistence
>         Attachments: BugFinder.java
>
>
> I was working on a Column family with a DynamicComposite column sorter when I 
> noticed that sometimes, after the insertion of a column with a column name 
> composed by a single string (eg 's@step'),it was possible to be reach the 
> column only by slice query but not by direct access. For example using the 
> cassandra-cli it is possible to query: 
> get frame[int(26)];
> RowKey: 0000001a
> ....
>  (column=i@19, value=00000013, timestamp=1343495134729000)
> => (column=s@step, value=746573742076616c7565, timestamp=1343495134680000)
> but typing 'get frame[int(26)]['s@step']' I got no result.
> I tested this behavior using also other clients such as Hector, Astyanax, 
> Pycassa and directly Thrift. 
> I wrote this java code with hector-core-1.1.0 to reproduce this bug.
> public static void main(String[] args) {
>         String kname = "testspace3";
>         Cluster myCluster = HFactory.getOrCreateCluster("Test-cluster", 
> System.getProperty("location", "localhost:9160"));
>         //creating the keyspace and Column family
>         if (myCluster.describeKeyspace(kname) != null) {
>             myCluster.dropKeyspace(kname, true);
>         }        
>         ColumnFamilyDefinition cfd = 
> HFactory.createColumnFamilyDefinition(kname, "frame", 
> ComparatorType.DYNAMICCOMPOSITETYPE);
>         
> cfd.setComparatorTypeAlias(DynamicComposite.DEFAULT_DYNAMIC_COMPOSITE_ALIASES);
>         KeyspaceDefinition kdf = HFactory.createKeyspaceDefinition(kname, 
> "SimpleStrategy", 1, Arrays.asList(cfd));
>         myCluster.addKeyspace(kdf, true);
>         Keyspace ksp = HFactory.createKeyspace(kname, myCluster);
>         //Hector template definition
>         ColumnFamilyTemplate<Integer, DynamicComposite> template =
>                 new ThriftColumnFamilyTemplate<Integer, DynamicComposite>(
>                 ksp,
>                 "frame",
>                 IntegerSerializer.get(),
>                 DynamicCompositeSerializer.get());
>         
>         DynamicComposite dc = new DynamicComposite();
>         dc.addComponent("step", StringSerializer.get());
>         DynamicComposite numdc = new DynamicComposite();
>         numdc.addComponent(BigInteger.valueOf(62), 
> BigIntegerSerializer.get());
>         ColumnFamilyUpdater<Integer, DynamicComposite> cf = 
> template.createUpdater(26);
>         cf.setString(dc, "test value");
>         cf.setString(numdc, "altro valore");
>         template.update(cf);
>         //without this parts it works. It works also with less then 4 
> insertions
>         cf = template.createUpdater(26);
>         for (int i = 0; i < 4; i++) {
>             DynamicComposite num = new DynamicComposite();
>             num.addComponent(BigInteger.valueOf(i), 
> BigIntegerSerializer.get());
>             cf.setInteger(num, i);
>         }
>         template.update(cf);
>         // end part
>         HColumn<DynamicComposite, String> res = 
> template.querySingleColumn(26, dc, StringSerializer.get());
>         if (res == null) {
>             System.out.println("[FAIL] Row not found");
>         } else {
>             System.out.println("[SUCCESS] Returned name " + 
> res.getName().get(0).toString() + " - with value: " + res.getValue());
>         }
>     }
> The code acts three tasks: configure keyspace an CF, insert the data and try 
> to retrieve it. After running the code the data are visible (by list for 
> example) but not reachable directly. Restarting Cassandra the row is again 
> reachable. 
> Furthermore, after running that code, if I run on the cassandra-cli 
> set frame[int(26)]['s@step']=utf8(test);
> with a "list frame[int(26)]'
> RowKey: 0000001a
> => (column=s@step, value=test value, timestamp=1343499335791000)
> => (column=i@0, value=00000000, timestamp=1343499335816000)
> => (column=i@1, value=00000001, timestamp=1343499335816000)
> => (column=i@2, value=00000002, timestamp=1343499335816000)
> => (column=i@3, value=00000003, timestamp=1343499335816000)
> => (column=s@step, value=test, timestamp=1343499384630000)
> I found 2 column with the apparently the same column name. 
> How is it possible?
> Best regards,
> Cesare

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to