Hello,
the use case is to iterate over MySQL shards with empty tables by 
GenerateTableFetch 1.15.0.

The JDBC used is mysql-connector-java-8.0.21.jar.

The comment and exception do not seem to be correct since MySQL does return 0 
rows (Empty result set fetched).

GenerateTableFetch.java:432
                } else {
                    // Something is very wrong here, one row (even if count is 
zero) should be returned
                    throw new SQLException("No rows returned from metadata 
query: " + selectQuery);
                }
TimeGenerated /SyslogMessage
1/20/2022 6:30:47 AM  30:08,079 ERROR [Timer-Driven Process Thread-7] 
o.a.n.p.standard.GenerateTableFetch 
GenerateTableFetch[id=77301f26-bf7b-3935-65d7-7c0bba62250b] Unable to execute 
SQL select query SELECT -1 FROM vshard61.installation_shard due to 
java.sql.SQLException: No rows returned from metadata query: SELECT -1 FROM 
vshard61.installation_shard, routing 
StandardFlowFileRecord[uuid=65a4ee24-f4ea-4f05-b700-1b2dee8501ad,claim=StandardContentClaim
 [resourceClaim=StandardResourceClaim[id=1642620014051-1786413, 
container=default, section=557], offset=725920, 
length=585],offset=540,name=885be49a-807d-4888-8404-11413d072c40,size=9] to 
failure

Test in the MySQL server with 0 rows and 'Empty result set fetched' from an 
empty table.

13:09:19  SUCCESS  [SELECT - 1 000 rows, 0.061 secs]  Result set fetched. 
Number of rows limited by Max Rows
/* contains rows */
SELECT -1 FROM vshard60.installation_shard;

13:09:19  SUCCESS  [SELECT - 0 rows, 0.063 secs]  Empty result set fetched
/* empty table */
SELECT -1 FROM vshard61.installation_shard;

It would be possible to detect the existence of the empty result set? Maybe too 
minor issue to address?

/* returns 1 */
select if ( exists( select -1 FROM vshard60.installation_shard ), 1, 0 );

/* returns 0 */
select if ( exists( select -1 FROM vshard61.installation_shard ), 1, 0 );

Reply via email to