diff --git a/pom.xml b/pom.xml
index 9d795d7..bdf27cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
aerospike-jdbc
A JDBC driver for the Aerospike database
https://github.com/aerospike/aerospike-jdbc
- 1.7.1
+ 1.7.2
false
@@ -26,11 +26,15 @@
3.4.0
1.6.13
- 6.1.6
- 4.1.87.Final
+ 6.1.8
+ 4.1.90.Final
2.14.2
- 1.32.0
+ 1.34.0
4.5.14
+
+ 3.24.2
+ 7.5
+ 3.37.1
@@ -121,21 +125,21 @@
org.assertj
assertj-core
- 3.23.1
+ ${assertj.version}
test
org.testng
testng
- 7.5
+ ${testng.version}
test
org.jdbi
jdbi3-core
- 3.33.0
+ ${jdbi.version}
test
diff --git a/src/main/java/com/aerospike/jdbc/AerospikeDatabaseMetadata.java b/src/main/java/com/aerospike/jdbc/AerospikeDatabaseMetadata.java
index e894887..2d82063 100644
--- a/src/main/java/com/aerospike/jdbc/AerospikeDatabaseMetadata.java
+++ b/src/main/java/com/aerospike/jdbc/AerospikeDatabaseMetadata.java
@@ -32,6 +32,7 @@
import static com.aerospike.jdbc.util.AerospikeUtils.getIndexBinValuesRatio;
import static com.aerospike.jdbc.util.Constants.defaultKeyName;
+import static com.aerospike.jdbc.util.Constants.defaultSchemaName;
import static com.aerospike.jdbc.util.Constants.schemaScanRecords;
import static java.lang.String.format;
import static java.sql.Connection.TRANSACTION_NONE;
@@ -78,7 +79,7 @@ public AerospikeDatabaseMetadata(String url, IAerospikeClient client, Connection
namespaces.addAll(asList(getOrDefault(r, "namespaces", "").split(";")));
streamOfSubProperties(r, "sets").forEach(p ->
tables.computeIfAbsent(p.getProperty("ns"), s -> new HashSet<>())
- .add(p.getProperty("set"))
+ .addAll(Arrays.asList(p.getProperty("set"), defaultSchemaName))
);
streamOfSubProperties(r, "sindex")
.filter(AerospikeUtils::isSupportedIndexType)
@@ -245,17 +246,17 @@ public String getNumericFunctions() {
@Override
public String getStringFunctions() {
- return null;
+ return "";
}
@Override
public String getSystemFunctions() {
- return null;
+ return "";
}
@Override
public String getTimeDateFunctions() {
- return null;
+ return "";
}
@Override
@@ -949,14 +950,16 @@ public ResultSet getTypeInfo() {
@Override
public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) {
- final Iterable> indicesData;
+ Stream secondaryIndexStream;
if (catalog == null) {
- indicesData = indices.entrySet().stream().flatMap(p -> p.getValue().stream())
- .map(this::indexInfoAsList).collect(Collectors.toList());
+ secondaryIndexStream = indices.entrySet().stream().flatMap(p -> p.getValue().stream());
} else {
- indicesData = getOrDefault(indices, catalog, Collections.emptyList()).stream()
- .map(this::indexInfoAsList).collect(Collectors.toList());
+ secondaryIndexStream = getOrDefault(indices, catalog, Collections.emptyList()).stream();
}
+ final Iterable> indicesData = secondaryIndexStream
+ .filter(i -> i.getNamespace().equals(schema) && i.getSet().equals(table))
+ .map(this::indexInfoAsList)
+ .collect(Collectors.toList());
String[] columns = new String[]{"TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "NON_UNIQUE", "INDEX_QUALIFIER",
"INDEX_NAME", "TYPE", "ORDINAL_POSITION", "COLUMN_NAME", "ASC_OR_DESC", "CARDINALITY",
diff --git a/src/main/java/com/aerospike/jdbc/async/ScanQueryHandler.java b/src/main/java/com/aerospike/jdbc/async/ScanQueryHandler.java
index 22778b6..2a4b112 100644
--- a/src/main/java/com/aerospike/jdbc/async/ScanQueryHandler.java
+++ b/src/main/java/com/aerospike/jdbc/async/ScanQueryHandler.java
@@ -46,7 +46,7 @@ public RecordSet execute(ScanPolicy scanPolicy, AerospikeQuery query) {
long maxRecords = scanPolicy.maxRecords;
PartitionFilter filter = getPartitionFilter(query);
while (isScanRequired(maxRecords)) {
- client.scanPartitions(scanPolicy, filter, query.getSchema(), query.getTable(),
+ client.scanPartitions(scanPolicy, filter, query.getSchema(), query.getSetName(),
callback, query.getBinNames());
scanPolicy.maxRecords = maxRecords > 0 ? maxRecords - count : maxRecords;
filter = PartitionFilter.id(++currentPartition);
@@ -54,13 +54,13 @@ public RecordSet execute(ScanPolicy scanPolicy, AerospikeQuery query) {
listener.onSuccess();
} else {
client.scanAll(EventLoopProvider.getEventLoop(), listener, scanPolicy, query.getSchema(),
- query.getTable(), query.getBinNames());
+ query.getSetName(), query.getBinNames());
}
return listener.getRecordSet();
}
private PartitionFilter getPartitionFilter(AerospikeQuery query) {
- Key key = new Key(query.getSchema(), query.getTable(), query.getOffset());
+ Key key = new Key(query.getSchema(), query.getSetName(), query.getOffset());
currentPartition = Partition.getPartitionId(key.digest);
return PartitionFilter.after(key);
}
diff --git a/src/main/java/com/aerospike/jdbc/model/AerospikeQuery.java b/src/main/java/com/aerospike/jdbc/model/AerospikeQuery.java
index 6011ec7..469dcec 100644
--- a/src/main/java/com/aerospike/jdbc/model/AerospikeQuery.java
+++ b/src/main/java/com/aerospike/jdbc/model/AerospikeQuery.java
@@ -15,6 +15,8 @@
import java.util.List;
import java.util.Map;
+import static com.aerospike.jdbc.util.Constants.defaultSchemaName;
+
public class AerospikeQuery {
@VisibleForTesting
@@ -88,6 +90,13 @@ public void setTable(String table) {
}
}
+ public String getSetName() {
+ if (table.equals(defaultSchemaName)) {
+ return null;
+ }
+ return table;
+ }
+
public SchemaTableName getSchemaTable() {
return new SchemaTableName(schema, table);
}
diff --git a/src/main/java/com/aerospike/jdbc/query/DeleteQueryHandler.java b/src/main/java/com/aerospike/jdbc/query/DeleteQueryHandler.java
index b44307f..19ab3e3 100644
--- a/src/main/java/com/aerospike/jdbc/query/DeleteQueryHandler.java
+++ b/src/main/java/com/aerospike/jdbc/query/DeleteQueryHandler.java
@@ -38,7 +38,7 @@ public Pair execute(AerospikeQuery query) {
logger.info("DELETE primary key");
FutureDeleteListener listener = new FutureDeleteListener(keyObjects.size());
for (Object keyObject : keyObjects) {
- Key key = new Key(query.getSchema(), query.getTable(), Value.get(keyObject));
+ Key key = new Key(query.getSchema(), query.getSetName(), Value.get(keyObject));
try {
client.delete(EventLoopProvider.getEventLoop(), listener, writePolicy, key);
} catch (AerospikeException e) {
@@ -57,7 +57,7 @@ public Pair execute(AerospikeQuery query) {
ScanPolicy scanPolicy = buildScanPolicy(query);
scanPolicy.includeBinData = false;
client.scanAll(EventLoopProvider.getEventLoop(), listener, scanPolicy, query.getSchema(),
- query.getTable());
+ query.getSetName());
final AtomicInteger count = new AtomicInteger();
listener.getRecordSet().forEach(r -> {
diff --git a/src/main/java/com/aerospike/jdbc/query/InsertQueryHandler.java b/src/main/java/com/aerospike/jdbc/query/InsertQueryHandler.java
index 5d733db..22e3463 100644
--- a/src/main/java/com/aerospike/jdbc/query/InsertQueryHandler.java
+++ b/src/main/java/com/aerospike/jdbc/query/InsertQueryHandler.java
@@ -53,7 +53,7 @@ public Pair putConsecutively(AerospikeQuery query) {
@SuppressWarnings("unchecked")
List