Skip to content

Commit 3408bbe

Browse files
author
psainics
committed
Improve zero-record log messages for split and SQL statement readers
- DBTableRecordReader: log table name and split query so users can identify which table and range returned no records - SQLStatementRecordReader: log the SQL statement instead of the resolved table name for clarity
1 parent feaff84 commit 3408bbe

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/io/cdap/plugin/format/DBTableRecordReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public boolean nextKeyValue() throws IOException {
8989
}
9090
if (!results.next()) {
9191
if (pos == 0) {
92-
LOG.warn("Table '{}' had no records to read.", tableName.getTable());
92+
LOG.warn("Split for table '{}' returned no records. Split query: '{}'",
93+
tableName.getTable(), getQuery());
9394
}
9495
return false;
9596
}

src/main/java/io/cdap/plugin/format/SQLStatementRecordReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public boolean nextKeyValue() throws IOException {
8989
}
9090
if (!results.next()) {
9191
if (pos == 0) {
92-
LOG.warn("Table '{}' had no records to read.", tableName);
92+
LOG.warn("SQL statement '{}' returned no records.", split.getSqlStatement());
9393
}
9494
return false;
9595
}

0 commit comments

Comments
 (0)