Selections from materialized views my have different entity properties that impact generated queries. Remove noisy/expensive selection of ttl and write time until we need/use it for cache correctness properties (if ever).

This commit is contained in:
Greg Burd 2017-10-12 09:23:00 -04:00
parent 4e461c1be0
commit 3ef4ddd5a0
2 changed files with 9 additions and 7 deletions

View file

@ -133,12 +133,12 @@ public final class SelectOperation<E> extends AbstractFilterStreamOperation<E, S
Objects.requireNonNull(materializedViewClass); Objects.requireNonNull(materializedViewClass);
HelenusEntity entity = Helenus.entity(materializedViewClass); HelenusEntity entity = Helenus.entity(materializedViewClass);
this.alternateTableName = entity.getName().toCql(); this.alternateTableName = entity.getName().toCql();
this.allowFiltering = true; this.props.clear();
return this; entity
} .getOrderedProperties()
.stream()
public SelectOperation<E> from(String alternateTableName) { .map(p -> new HelenusPropertyNode(p, Optional.empty()))
this.alternateTableName = alternateTableName; .forEach(p -> this.props.add(p));
return this; return this;
} }
@ -243,6 +243,7 @@ public final class SelectOperation<E> extends AbstractFilterStreamOperation<E, S
+ prop.getEntity().getMappingInterface()); + prop.getEntity().getMappingInterface());
} }
/* TODO: is this useful information to gather when caching?
if (cached) { if (cached) {
switch (prop.getProperty().getColumnType()) { switch (prop.getProperty().getColumnType()) {
case PARTITION_KEY: case PARTITION_KEY:
@ -261,6 +262,7 @@ public final class SelectOperation<E> extends AbstractFilterStreamOperation<E, S
break; break;
} }
} }
*/
} }
if (entity == null) { if (entity == null) {

View file

@ -70,7 +70,7 @@ public class MaterializedViewTest extends AbstractEmbeddedCassandraTest {
public void testMv() throws Exception { public void testMv() throws Exception {
session session
.select(Cyclist.class) .select(Cyclist.class)
.<CyclistsByAge>from(CyclistsByAge.class) .from(CyclistsByAge.class)
.where(cyclist::age, eq(18)) .where(cyclist::age, eq(18))
.sync(); .sync();
} }