You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/12/15 22:39:00 UTC

[jira] [Commented] (NIFI-9476) QueryRecord fails when no result and with a column of array type

    [ https://issues.apache.org/jira/browse/NIFI-9476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17460287#comment-17460287 ] 

ASF subversion and git services commented on NIFI-9476:
-------------------------------------------------------

Commit 90930ca1970450255ace314d050914293f2e6599 in nifi's branch refs/heads/main from Pierre Villard
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=90930ca ]

NIFI-9476 - Fix QueryRecord when no result and with array type column

Signed-off-by: Matthew Burgess <ma...@apache.org>

This closes #5594


> QueryRecord fails when no result and with a column of array type
> ----------------------------------------------------------------
>
>                 Key: NIFI-9476
>                 URL: https://issues.apache.org/jira/browse/NIFI-9476
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Pierre Villard
>            Assignee: Pierre Villard
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> QueryRecord will fail if there is no record matching the query and if one the columns returned as part of the result is of array type.
> This is because we build the schema from the result set metadata (before actually looking if there are rows or not) except for arrays where we have to get the first row of the result set to figure out the type of the array. This raises an exception when we don't have any row in the result set. In such a case, we'll just assume an array of strings if no row available.
> Here is the exception:
> {code:java}
> ERROR org.apache.nifi.processors.standard.QueryRecord - QueryRecord[id=c21e44c4-2e6e-488b-9096-47753dfa429c] Unable to query FlowFile[0,404685028855838.mockFlowFile,50B] due to org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END: org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END
> org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END
> 	at org.apache.nifi.processors.standard.QueryRecord$1.process(QueryRecord.java:343)
> 	at org.apache.nifi.util.MockProcessSession.write(MockProcessSession.java:907)
> 	at org.apache.nifi.util.MockProcessSession.write(MockProcessSession.java:67)
> 	at org.apache.nifi.processors.standard.QueryRecord.onTrigger(QueryRecord.java:332)
> 	at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
> 	at org.apache.nifi.util.StandardProcessorTestRunner$RunProcessor.call(StandardProcessorTestRunner.java:284)
> 	at org.apache.nifi.util.StandardProcessorTestRunner$RunProcessor.call(StandardProcessorTestRunner.java:278)
> 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> 	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> 	at java.base/java.lang.Thread.run(Thread.java:829)
> Caused by: java.sql.SQLException: java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END
> 	at org.apache.calcite.avatica.util.PositionedCursor$ArrayGetter.getObject(PositionedCursor.java:65)
> 	at org.apache.calcite.avatica.util.AbstractCursor$AccessorImpl.getObject(AbstractCursor.java:357)
> 	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getObject(AbstractCursor.java:1335)
> 	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getArray(AbstractCursor.java:1403)
> 	at org.apache.calcite.avatica.AvaticaResultSet.getArray(AvaticaResultSet.java:731)
> 	at org.apache.nifi.serialization.record.ResultSetRecordSet.getArrayDataType(ResultSetRecordSet.java:296)
> 	at org.apache.nifi.serialization.record.ResultSetRecordSet.getDataType(ResultSetRecordSet.java:208)
> 	at org.apache.nifi.serialization.record.ResultSetRecordSet.createSchema(ResultSetRecordSet.java:185)
> 	at org.apache.nifi.serialization.record.ResultSetRecordSet.<init>(ResultSetRecordSet.java:87)
> 	at org.apache.nifi.serialization.record.ResultSetRecordSet.<init>(ResultSetRecordSet.java:72)
> 	at org.apache.nifi.processors.standard.QueryRecord$1.process(QueryRecord.java:339)
> 	... 11 more
> Caused by: java.util.NoSuchElementException: Expecting cursor position to be Position.OK, actual is Position.AFTER_END
> 	at org.apache.calcite.avatica.util.IteratorCursor.current(IteratorCursor.java:71)
> 	at org.apache.calcite.avatica.util.PositionedCursor$ArrayGetter.getObject(PositionedCursor.java:55)
> 	... 21 more {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)