When we use big numeric values as part of a parameterized query, they do not return the results. In the example below, it returns no results when it should return some in our environment. Queries work fine from the Couchbase Query UI (of course there is no parameterized queries).
long accountId = 800390432;
String prefix = "PREFIX";
String query = "SELECT id from data1 where split(meta().id, \"::\")[0]=$env and accountId=$accountId"
Map<String, Object> params = new HashMap<>();
params.put("accountId", accountId);
params.put("env", env);
N1qlParams n1qlParams = N1qlParams.build()
.adhoc(true)
.pretty(false
.consistency(ScanConsistency.NOT_BOUNDED);
ParameterizedN1qlQuery parameterized = N1qlQuery.parameterized(query, convert(params), n1qlParams);
N1qlQueryResult result = sourceBucket.query(parameterized, 10000, TimeUnit.MILLISECONDS);
Performing the above query as-is returns no results.
Performing the above query by replacing accountId directly in the query works fine (returns 5 results). Also, I’m told that smaller numeric values work fine as well. The parameterization of the env
works fine both ways.
We’re using Couchbase 4.5.1 and Java client 2.5.1.