You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2015/04/16 16:32:10 UTC
[29/50] [abbrv] phoenix git commit: PHOENIX-1755 Improve error
logging if csv line has insufficient fields
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/ff0e8e4e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ff0e8e4e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ff0e8e4e
Branch: refs/heads/calcite
Commit: ff0e8e4edceb5847a2eeb86500f4784525881d6d
Parents: f666baa
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:09 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/ff0e8e4e/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) {