phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cox, Jonathan A" <>
Subject Help calling CsvBulkLoadTool from Java Method
Date Thu, 17 Dec 2015 23:17:11 GMT
I'm wondering if somebody can provide some guidance on how to use CsvBulkLoadTool from within
a Java Class, instead of via the command line, as is shown in the documentation. I'd like
to determine if CsvBulkLoadTool ran without throwing any exceptions. However, exceptions generated
by org.apache.phoenix.* don't seem to be thrown up to the calling method (,
or at least result in a non-zero return code.

Here is what I am doing:
import org.apache.phoenix.mapreduce.CsvBulkLoadTool;
import org.apache.hadoop.util.ToolRunner;

CsvBulkLoadTool csvBulkLoader = new CsvBulkLoadTool();
int tret;
String[] args = {"-d", "\t", "--table", "MyTableName", "--input", "file://myfile.tsv"};

tret =, args);

When I run this code, I get a return code (tret) of zero and no errors in the console output.
However, the data is not loaded into HBase. When running the same commands on the command
line, I discovered that Phoenix can throw various errors (e.g. wrong column datatype, permission
error, whatever...). But there doesn't seem to be a way for me to discover these errors from
either exceptions that CsvBulkLoadTool throws or via the return code.

What's the best way to determine if CsvBulkLoadTool ran without error?


View raw message