From 460f9f5b0f30b4ddd5d568ea4c381779e9dcf6f3 Mon Sep 17 00:00:00 2001 From: nishadi Date: Sun, 13 Aug 2017 19:47:51 +0530 Subject: [PATCH] Add support to retrieve partitions in aerospike module --- .../gora/aerospike/store/AerospikeStore.java | 15 +++- .../aerospike/store/TestAerospikeStore.java | 85 +++++++++---------- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java b/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java index 67751670a..0d5e23f58 100644 --- a/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java +++ b/gora-aerospike/src/main/java/org/apache/gora/aerospike/store/AerospikeStore.java @@ -45,6 +45,7 @@ import org.apache.gora.query.PartitionQuery; import org.apache.gora.query.Query; import org.apache.gora.query.Result; +import org.apache.gora.query.impl.PartitionQueryImpl; import org.apache.gora.store.impl.DataStoreBase; import org.apache.gora.util.AvroUtils; import org.slf4j.Logger; @@ -322,11 +323,21 @@ public Query newQuery() { } /** - * The functionality is not supported as query key ranges are not supported + * {@inheritDoc} + * As the Aerospike does not support query key ranges as at the moment, only the single partition + * is retrieved with this method. + * + * @param query the query to execute. + * @return the list of partitions, one partion at the list as at the moment */ @Override public List> getPartitions(Query query) throws IOException { - return null; + List> partitions = new ArrayList<>(); + PartitionQueryImpl partitionQuery = new PartitionQueryImpl<>( + query); + partitionQuery.setConf(getConf()); + partitions.add(partitionQuery); + return partitions; } @Override diff --git a/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java b/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java index c1b4e2d28..df85258b7 100644 --- a/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java +++ b/gora-aerospike/src/test/java/org/apache/gora/aerospike/store/TestAerospikeStore.java @@ -60,27 +60,6 @@ public void tearDown() throws Exception { super.tearDown(); } - @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testTruncateSchema() throws Exception { - super.testTruncateSchema(); - } - - @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testDeleteSchema() throws Exception { - super.testDeleteSchema(); - } - - @Test - @Ignore("Explicit schema creation related functionality is not supported in Aerospike") - @Override - public void testSchemaExists() throws Exception { - super.testSchemaExists(); - } - @Test @Override public void testQuery() throws Exception { @@ -93,27 +72,6 @@ public void testQuery() throws Exception { super.testQuery(); } - @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryStartKey() throws Exception { - super.testQueryStartKey(); - } - - @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryEndKey() throws Exception { - super.testQueryEndKey(); - } - - @Test - @Ignore("Query key ranges based on primary key is not supported via the java client") - @Override - public void testQueryKeyRange() throws Exception { - super.testQueryKeyRange(); - } - @Test @Override public void testDelete() throws Exception { @@ -156,11 +114,48 @@ public void testDeleteByQuery() throws Exception { webPageStore.truncateSchema(); } + // Unsupported functionality due to the limitations in Aerospike java client + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testTruncateSchema() throws Exception { + super.testTruncateSchema(); + } + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testDeleteSchema() throws Exception { + super.testDeleteSchema(); + } + + @Test + @Ignore("Explicit schema creation related functionality is not supported in Aerospike") + @Override + public void testSchemaExists() throws Exception { + super.testSchemaExists(); + } + + @Test + @Ignore("Query key ranges based on primary key is not supported via the java client") + @Override + public void testQueryStartKey() throws Exception { + super.testQueryStartKey(); + } + @Test - @Ignore("Functionality is to be implemented in the next iteration") + @Ignore("Query key ranges based on primary key is not supported via the java client") + @Override + public void testQueryEndKey() throws Exception { + super.testQueryEndKey(); + } + + @Test + @Ignore("Query key ranges based on primary key is not supported via the java client") @Override - public void testGetPartitions() throws Exception { - super.testGetPartitions(); + public void testQueryKeyRange() throws Exception { + super.testQueryKeyRange(); } @Test