You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by gr...@apache.org on 2015/04/07 21:15:36 UTC
phoenix git commit: PHOENIX-1755 Improve error logging if csv line
has insufficient fields
Repository: phoenix
Updated Branches:
refs/heads/4.x-HBase-0.98 15f769fa4 -> 5aea0b82d
PHOENIX-1755 Improve error logging if csv line has insufficient fields
Signed-off-by: Gabriel Reid <ga...@ngdata.com>
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5aea0b82
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5aea0b82
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5aea0b82
Branch: refs/heads/4.x-HBase-0.98
Commit: 5aea0b82d8caada3d7478666b880ef7c59ed89c9
Parents: 15f769f
Author: Karel Vervaeke <ka...@ngdata.com>
Authored: Thu Mar 19 16:10:07 2015 +0100
Committer: Gabriel Reid <ga...@ngdata.com>
Committed: Tue Apr 7 21:15:19 2015 +0200
----------------------------------------------------------------------
.../java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/5aea0b82/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
index b5f6f9f..0e3294b 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/csv/CsvUpsertExecutor.java
@@ -144,6 +144,11 @@ public class CsvUpsertExecutor implements Closeable {
*/
void execute(CSVRecord csvRecord) {
try {
+ if (csvRecord.size() < conversionFunctions.size()) {
+ String message = String.format("CSV record does not have enough values (has %d, but needs %d)",
+ csvRecord.size(), conversionFunctions.size());
+ throw new IllegalArgumentException(message);
+ }
for (int fieldIndex = 0; fieldIndex < conversionFunctions.size(); fieldIndex++) {
Object sqlValue = conversionFunctions.get(fieldIndex).apply(csvRecord.get(fieldIndex));
if (sqlValue != null) {