From eb31431162980b9059bcdfccb683b5be63bc45c3 Mon Sep 17 00:00:00 2001 From: Michael Mulligan Date: Thu, 6 Nov 2014 14:18:01 -0500 Subject: [PATCH] CompositeEntityManager now allows for reversible queries (RangeBuilder.setReversed was not accessible via NativeQuery) --- .../astyanax/entitystore/CompositeEntityManager.java | 1 + .../java/com/netflix/astyanax/entitystore/NativeQuery.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityManager.java b/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityManager.java index e9d0edfa7..802b3b4ab 100644 --- a/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityManager.java +++ b/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/CompositeEntityManager.java @@ -632,6 +632,7 @@ private RowSliceQuery prepareQuery() { .setStart(endpoints[0]) .setEnd(endpoints[1]) .setLimit(columnLimit) + .setReversed(reverse) .build()); } diff --git a/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/NativeQuery.java b/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/NativeQuery.java index dd23bc630..c99eb0264 100644 --- a/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/NativeQuery.java +++ b/astyanax-entity-mapper/src/main/java/com/netflix/astyanax/entitystore/NativeQuery.java @@ -23,6 +23,7 @@ public abstract class NativeQuery { protected Collection columnNames; protected List predicates; protected int columnLimit = Integer.MAX_VALUE; + protected boolean reverse = false; /** * Refine query for row key @@ -98,6 +99,11 @@ public NativeQuery limit(int columnLimit) { return this; } + public NativeQuery reverse(boolean reverse) { + this.reverse = reverse; + return this; + } + private NativeQuery addPredicate(ColumnPredicate predicate) { if (predicates == null) { predicates = Lists.newArrayList();