Errors code 4070 with message "Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: No operator for name DistinctScan" when query data by REST API of prepared statement

n1ql

#1

I am using Couchbase Server Version: 4.5.0-2601 Enterprise Edition (build-2601) .
My N1QL works fine, and When I query data by:

curl -v http://127.0.0.1:8093/query/service -H "Content-Type: application/json" -d  '{ "prepared":"fetchDataTest", "encoded_plan":"encoded_paln_codes", "$key":"key1" }'

PS: encoded_paln_codes is query from system:prepareds by name == "fetchDataTest"
it return the following error:

{
    "requestID": "e1c86760-6b7a-4fc6-a652-576d5c74fb37",
    "errors": [
        {
            "code": 4070,
            "msg": "Unable to decode prepared statement - cause: Unrecognizable prepared statement - cause: JSON unmarshalling error: No operator for name DistinctScan"
        }
    ],
    "status": "fatal",
    "metrics": {
        "elapsedTime": "64.179µs",
        "executionTime": "63.847µs",
        "resultCount": 0,
        "resultSize": 0,
        "errorCount": 1
    }
}

but the same query by name works fine:

curl -v http://127.0.0.1:8093/query/service -H "Content-Type: application/json" -d  '{ "prepared":"fetchDataTest", "$key":"key1" }'

and

curl -v http://127.0.0.1:8093/query/service -d 'prepared="fetchDataTest"&$key="key1"'

#2

Fixed in 4.5.1. Sorry about that.


#3

ok, got it. Thank you very much.


#4

Dear users,

I’m facing a very similar issue when using the last version of the .NET SDK, but with OrderedIntersectScan.

ClientContextId: Message: Error: 4070 Unable to decode prepared statement
cause: Unrecognizable prepared statement
cause: JSON unmarshalling error: No operator for name OrderedIntersectScan

The strange thing is sometimes the query returns result, sometimes it gives me this error.
The query is formed like this:

SELECT autocompleteInfo.* FROM products
WHERE 1 = 1 AND type <> 'shop'
AND stats.rankingPosition is not missing
AND ANY v IN searchKeyA SATISFIES v = $1 END
[AND ANY v IN searchKeyA SATISFIES v = $2 END ...]
ORDER BY stats.rankingPosition
LIMIT 7;

I’m running 4.6.3 EE on server.

Stefano


#5

Hi @stefano.redaelli,

Opened MB-26012.

Workaround will be try adhoc=true


#6

Thank you @vsr1,

I’m very grateful for your help, have a nice day.

Stefano