IBM Support

IT39267: NOSQL JAVA DRIVER THROWS RUNTIMEEXCEPTION FOR $SAMPLE IN AGGREGATE PIPELINE

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • IBM NoSQL Java Driver, NoSQL Command Line and JSON Wire Listener
    throws RuntimeException if $sample stage is used in
    db.collection.aggregate() pipeline.
    
    For a collection "book" in test db, the command
    "db.book.aggregate( [ { $sample:{ size: 3 }} ])" throws below
    exception:
    
    An exception has been thrown: java.lang.RuntimeException :
    CDJSN0101E Execution failed in the following expression:
    "$sample"
    at
    com.ibm.nosql.json.api.DBQueryAnalyzer.handleJSONTask(DBQueryAna
    lyzer.java:126)
    at
    com.ibm.nosql.json.api.DBQueryAnalyzer.makeSQLQueryTasks(DBQuery
    Analyzer.java:58)
    at
    com.ibm.nosql.json.api.DBQueryBuilder.buildQuery(DBQueryBuilder.
    java:269)
    at
    com.ibm.nosql.json.api.DBCursorAggregate.find(DBCursorAggregate.
    java:189)
    at com.ibm.nosql.json.api.DBCursor.hasNext(DBCursor.java:278)
    at
    com.ibm.nosql.json.api.DBCollection.aggregate(DBCollection.java:
    4537)
    at
    com.ibm.nosql.db2wire.server.DB2AggregationHelper.pipeline(DB2Ag
    gregationHelper.java:90)
    at
    com.ibm.nosql.db2wire.server.DB2Plugin.query(DB2Plugin.java:504)
    at com.ibm.nosql.driver.opMessage.Message(opMessage.java:183)
    at
    com.ibm.nosql.socket.channel.NoSQLInboundLink.handleMessage(NoSQ
    LInboundLink.java:433)
    at
    com.ibm.nosql.socket.channel.NoSQLInboundLink.complete(NoSQLInbo
    undLink.java:196)
    at
    com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.requestComplete(
    WorkQueueManager.java:551)
    at
    com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQu
    eueManager.java:601)
    at
    com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.workerRun(WorkQu
    eueManager.java:948)
    at
    com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQ
    ueueManager.java:1027)
    at
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExec
    utor.java:1156)
    at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExe
    cutor.java:626)
    at
    com.ibm.ws.objectgrid.thread.XSThreadPool$Worker.run(XSThreadPoo
    l.java:282)
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * IBM NoSQL/JSON Wire listener is used to run aggregate        *
    * command with $sample option.                                 *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * IBM NoSQL Java Driver, NoSQL Command Line and JSON Wire      *
    * Listener throws RuntimeException if $sample stage is used in *
    * db.collection.aggregate() pipeline. For a collection "book"  *
    * in test db, the command "db.book.aggregate( [ { $sample:{    *
    * size: 3 }} ])" throws below exception:                       *
    *                                                              *
    * An exception has been thrown: java.lang.RuntimeException     *
    * :CDJSN0101E Execution failed in the following expression:    *
    * "$sample"                                                    *
    * at                                                           *
    * com.ibm.nosql.json.api.DBQueryAnalyzer.handleJSONTask(DBQuer *
    * yAnalyzer.java:126)                                          *
    * at                                                           *
    * com.ibm.nosql.json.api.DBQueryAnalyzer.makeSQLQueryTasks(DBQ *
    * ueryAnalyzer.java:58)                                        *
    * at                                                           *
    * com.ibm.nosql.json.api.DBQueryBuilder.buildQuery(DBQueryBuil *
    * der.java:269)                                                *
    * at                                                           *
    * com.ibm.nosql.json.api.DBCursorAggregate.find(DBCursorAggreg *
    * ate.java:189)                                                *
    * at                                                           *
    * com.ibm.nosql.json.api.DBCursor.hasNext(DBCursor.java:278)   *
    * at                                                           *
    * com.ibm.nosql.json.api.DBCollection.aggregate(DBCollection.j *
    * ava:4537)                                                    *
    * at                                                           *
    * com.ibm.nosql.db2wire.server.DB2AggregationHelper.pipeline(D *
    * B2AggregationHelper.java:90)                                 *
    * at                                                           *
    * com.ibm.nosql.db2wire.server.DB2Plugin.query(DB2Plugin.java: *
    * 504)                                                         *
    * at                                                           *
    * com.ibm.nosql.driver.opMessage.Message(opMessage.java:183)   *
    * at                                                           *
    * com.ibm.nosql.socket.channel.NoSQLInboundLink.handleMessage( *
    * NoSQLInboundLink.java:433)                                   *
    * at                                                           *
    * com.ibm.nosql.socket.channel.NoSQLInboundLink.complete(NoSQL *
    * InboundLink.java:196)                                        *
    * at                                                           *
    * com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.requestCompl *
    * ete(WorkQueueManager.java:551)                               *
    * at                                                           *
    * com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.attemptIO(Wo *
    * rkQueueManager.java:601)                                     *
    * at                                                           *
    * com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager.workerRun(Wo *
    * rkQueueManager.java:948)                                     *
    * at                                                           *
    * com.ibm.ws.xs.tcp.channel.impl.WorkQueueManager$Worker.run(W *
    * orkQueueManager.java:1027)                                   *
    * at                                                           *
    * java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool *
    * Executor.java:1156)                                          *
    * at                                                           *
    * java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo *
    * lExecutor.java:626)                                          *
    * at                                                           *
    * com.ibm.ws.objectgrid.thread.XSThreadPool$Worker.run(XSThrea *
    * dPool.java:282)                                              *
    ****************************************************************
    * RECOMMENDATION:                                              *
    * Upgrade to Db2 version 11.5.7.1 or later releases.           *
    ****************************************************************
    

Problem conclusion

  • db2_v11571 contains fix of this issue. After the fix, exception
    no longer occurs and $sample gives correct result.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IT39267

  • Reported component name

    DB2 CONNECT

  • Reported component ID

    DB2CONNCT

  • Reported release

    B50

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2021-11-30

  • Closed date

    2021-12-15

  • Last modified date

    2021-12-15

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    DB2 CONNECT

  • Fixed component ID

    DB2CONNCT

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M"},"Platform":[{"code":"PF054","label":"z\/OS"}],"Version":"11.5"}]

Document Information

Modified date:
16 December 2021