Permalink
Browse files

Reversing the conditions for issue #74

  • Loading branch information...
1 parent 6a16018 commit 8ed9cb233df111b79c23391f7aba535f48ad6fa3 @easility easility committed Sep 4, 2013
Showing with 16 additions and 13 deletions.
  1. +16 −13 src/main/java/com/alvazan/orm/layer9z/spi/db/cassandra/CassandraSession.java
@@ -353,26 +353,29 @@ public void clearImpl() throws ConnectionException {
throw new IllegalArgumentException("batch size must be supplied and be greater than 0");
String colFamily = info.getIndexColFamily();
byte[] rowKey = info.getRowKey();
- Info info1 = columnFamilies.fetchColumnFamilyInfo(colFamily, mgr);
+
+ //Here we don't bother using an index at all since there is no where clause to begin with
+ //ALSO, we don't want this code to be the case if we are doing a CursorToMany which has to use an index
+ //so check the column type
+ if(!info.getEntityColFamily().isVirtualCf() && from == null && to == null
+ && !(info.getColumnName() instanceof DboColumnToManyMeta)
+ && !info.getEntityColFamily().isInheritance()) {
+ Keyspace keyspace = columnFamilies.getKeyspace();
+ Info cfInfo = columnFamilies.lookupOrCreate2(info.getEntityColFamily().getRealColumnFamily(), mgr);
+ ScanCassandraCf scanner = new ScanCassandraCf(info, cfInfo, bListener, batchSize, keyspace);
+ scanner.beforeFirst();
+ return scanner;
+ }
+
+ Info info1 = columnFamilies.fetchColumnFamilyInfo(colFamily, mgr);
if(info1 == null) {
//well, if column family doesn't exist, then no entities exist either
if (log.isInfoEnabled())
log.info("query was run on column family that does not yet exist="+colFamily);
return new EmptyCursor<IndexColumn>();
}
- //Here we don't bother using an index at all since there is no where clause to begin with
- //ALSO, we don't want this code to be the case if we are doing a CursorToMany which has to use an index
- //so check the column type
- if(!info.getEntityColFamily().isVirtualCf() && from == null && to == null
- && !(info.getColumnName() instanceof DboColumnToManyMeta)
- && !info.getEntityColFamily().isInheritance()) {
- Keyspace keyspace = columnFamilies.getKeyspace();
- Info cfInfo = columnFamilies.lookupOrCreate2(info.getEntityColFamily().getRealColumnFamily(), mgr);
- ScanCassandraCf scanner = new ScanCassandraCf(info, cfInfo, bListener, batchSize, keyspace);
- scanner.beforeFirst();
- return scanner;
- }
+
String colName = null;
if(info.getColumnName() != null)

0 comments on commit 8ed9cb2

Please sign in to comment.