[
https://issues.apache.org/jira/browse/NIFI-7171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gregory Kline updated NIFI-7171:
--------------------------------
Description:
When GenerateTableFetch executes with the following conditions ...
# partition size = 0
# max value columns are unset
# connecting to MS SQL Server
# the target table has 0 rows
... the processor throws a SQLException "Unable to execute SQL select query
SELECT -1 FROM [mydb].[dbo].[tbl_test_01] due to java.sql.SQLException: No rows
returned from metadata query: SELECT -1 FROM [mydb].[dbo].[tbl_test_01]" and
rolls back the flow file.
The issue appears to be introduced in the fix for
https://issues.apache.org/jira/browse/NIFI-5855 when -1 was used in place of
"COUNT( * )". For an empty table, the SQL Server driver returns 0 rows for the
query "SELECT -1 FROM <table>". GenerateTableFetch throws a SQLException when
the resultset contains 0 rows.
Version details:
MS SQL Server: 12.0.6108.1
JDBC Driver: com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8
JDBC Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
Edit: 4/30/2020: After further testing, I have replicated this behavior
wi{color:#172b4d}th postgres:8.4 and mysql:8.0.13{color}
{color:#008000} {color}
was:
When GenerateTableFetch executes with the following conditions ...
# partition size = 0
# max value columns are unset
# connecting to MS SQL Server
# the target table has 0 rows
... the processor throws a SQLException "Unable to execute SQL select query
SELECT -1 FROM [mydb].[dbo].[tbl_test_01] due to java.sql.SQLException: No rows
returned from metadata query: SELECT -1 FROM [mydb].[dbo].[tbl_test_01]" and
rolls back the flow file.
The issue appears to be introduced in the fix for
https://issues.apache.org/jira/browse/NIFI-5855 when -1 was used in place of
"COUNT( * )". For an empty table, the SQL Server driver returns 0 rows for the
query "SELECT -1 FROM <table>". GenerateTableFetch throws a SQLException when
the resultset contains 0 rows.
Version details:
MS SQL Server: 12.0.6108.1
JDBC Driver: com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8
JDBC Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
> GenerateTableFetch produces SQLException when table is empty
> ------------------------------------------------------------
>
> Key: NIFI-7171
> URL: https://issues.apache.org/jira/browse/NIFI-7171
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.10.0, 1.11.2
> Reporter: Gregory Kline
> Priority: Major
>
> When GenerateTableFetch executes with the following conditions ...
> # partition size = 0
> # max value columns are unset
> # connecting to MS SQL Server
> # the target table has 0 rows
> ... the processor throws a SQLException "Unable to execute SQL select query
> SELECT -1 FROM [mydb].[dbo].[tbl_test_01] due to java.sql.SQLException: No
> rows returned from metadata query: SELECT -1 FROM [mydb].[dbo].[tbl_test_01]"
> and rolls back the flow file.
> The issue appears to be introduced in the fix for
> https://issues.apache.org/jira/browse/NIFI-5855 when -1 was used in place of
> "COUNT( * )". For an empty table, the SQL Server driver returns 0 rows for
> the query "SELECT -1 FROM <table>". GenerateTableFetch throws a SQLException
> when the resultset contains 0 rows.
>
> Version details:
> MS SQL Server: 12.0.6108.1
> JDBC Driver: com.microsoft.sqlserver:mssql-jdbc:7.4.1.jre8
> JDBC Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
>
> Edit: 4/30/2020: After further testing, I have replicated this behavior
> wi{color:#172b4d}th postgres:8.4 and mysql:8.0.13{color}
> {color:#008000} {color}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)