Merge branch 'master' of github.com:OpenRefine/OpenRefine
This commit is contained in:
commit
349d782a0e
@ -37,7 +37,7 @@ final class FusionTableSerializer implements TabularSerializer {
|
|||||||
@Override
|
@Override
|
||||||
public void endFile() {
|
public void endFile() {
|
||||||
if (sbBatch != null) {
|
if (sbBatch != null) {
|
||||||
sendBatch(true);
|
sendBatch(rows % BATCH_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,25 +61,21 @@ final class FusionTableSerializer implements TabularSerializer {
|
|||||||
formatCsv(cells, sbBatch);
|
formatCsv(cells, sbBatch);
|
||||||
rows++;
|
rows++;
|
||||||
if (rows % BATCH_SIZE == 0) {
|
if (rows % BATCH_SIZE == 0) {
|
||||||
if (!sendBatch(false)) {
|
if (!sendBatch(BATCH_SIZE)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean sendBatch(boolean isLastChunk) {
|
private boolean sendBatch(int batchSize) {
|
||||||
try {
|
try {
|
||||||
|
// TODO: we really want to do GZIP compression here
|
||||||
// FIXME: text/csv doesn't work even though that's what the content is
|
// FIXME: text/csv doesn't work even though that's what the content is
|
||||||
AbstractInputStreamContent content = ByteArrayContent.fromString("application/octet-stream", sbBatch.toString());
|
AbstractInputStreamContent content = ByteArrayContent.fromString("application/octet-stream", sbBatch.toString());
|
||||||
|
|
||||||
// AbstractInputStreamContent content = new InputStreamContent("application/octet-stream",
|
|
||||||
// // TODO: we really want to do GZIP compression here
|
|
||||||
// new ByteArrayInputStream(sbBatch.toString().getBytes("UTF-8")));
|
|
||||||
Long count = FusionTableHandler.insertRows(service, tableId, content);
|
Long count = FusionTableHandler.insertRows(service, tableId, content);
|
||||||
if (!isLastChunk && count != BATCH_SIZE) {
|
if (count != null && count.intValue() != batchSize) {
|
||||||
// FIXME: this message should say numbers instead of %d but we'd need to know the batch number for this
|
exceptions.add(new IOException("only imported " + count + " of " + batchSize + " rows"));
|
||||||
exceptions.add(new IOException("Only imported %d of %d rows"));
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
exceptions.add(e);
|
exceptions.add(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user