Permalink
Browse files

Fixing a defect related to partitioning

  • Loading branch information...
easility committed Apr 12, 2013
1 parent abbc75d commit 22d50a12667d03fd2c4683abeb59a4822420a4ce
@@ -407,15 +407,27 @@ private void initCaches() {
}
- public DboColumnMeta getAnyIndex(String indexedColumn) {
+ public DboColumnMeta getAnyIndex(String indexedColumn, DboColumnMeta partColMeta) {
initCaches();
if(indexedColumnsCache.size() == 0)
throw new IllegalArgumentException("The table="+columnFamily+" has no columnes with indexes. ie. no entity attributes had the @NoSqlIndexed annotation");
-
- if(indexedColumn == null) {
- //spread load over the index rows .....
- int index = r.nextInt(indexedColumnsCache.size());
- return indexedColumnsCache.get(index);
+ int index = 0;
+ if (indexedColumn == null) {
+ // spread load over the index rows .....
+ if (partColMeta == null) {
+ index = r.nextInt(indexedColumnsCache.size());
+ return indexedColumnsCache.get(index);
+ } else {
+ index = r.nextInt(indexedColumnsCache.size());
+ DboColumnMeta colMetaPart = indexedColumnsCache.get(index);
+ while (partColMeta.getColumnName().equals(
+ colMetaPart.getColumnName())) {
+ index = r.nextInt(indexedColumnsCache.size());
+ colMetaPart = indexedColumnsCache.get(index);
+ }
+ return colMetaPart;
+ }
+
}
DboColumnMeta colMeta = nameToField.get(indexedColumn);
@@ -79,7 +79,12 @@ private ByteArray getParameter(String parameterName) {
if(root == null) {
ViewInfoImpl tableInfo = (ViewInfoImpl) spiMeta.getTargetViews().get(0);
DboTableMeta tableMeta = tableInfo.getTableMeta();
- DboColumnMeta metaCol = tableMeta.getAnyIndex(indexedColumn);
+ PartitionMeta partitionMeta = tableInfo.getPartition();
+ DboColumnMeta partColMeta = null;
+ if (partitionMeta != null)
+ partColMeta = partitionMeta.getPartitionColumn();
+ DboColumnMeta metaCol = tableMeta.getAnyIndex(indexedColumn, partColMeta);
+
ScanInfo scanInfo = createScanInfo(tableInfo, metaCol);
alreadyJoinedViews.add(tableInfo);

0 comments on commit 22d50a1

Please sign in to comment.