GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — LoadStatistics stats = job.getStatistics() yields java.lang.ClassCastException · Issue #2652 · googleapis/google-cloud-java Closed DescriptionHi all, I am trying to insert some json data into a BigQuery table with Spark. Here is a snippet of code that is supposed to be doing the insertion: ...
TableId tableId = TableId.of(dataset_id, table_id);
BigQuery bigQuery = createAuthorizedClient(credential_json, project_id);
WriteChannelConfiguration writeChannelConfiguration =
WriteChannelConfiguration.newBuilder(tableId)
.setFormatOptions(FormatOptions.json())
.build();
TableDataWriteChannel writer = bigQuery.writer(writeChannelConfiguration);
ArrayList<StatementResult> al = new ArrayList<StatementResult>();
String jsonString = "";
long count = 0;
// concatenate all rows into one string.
for (Iterator<String> iter = stringIterator; iter.hasNext();) {
count++;
jsonString += "\n" + iter.next();
}
try {
if (count == 0) {
StatementResult sr = new StatementResult("", 0,0);
al.add(sr);
return al.iterator();
}
writer = bigQuery.writer(writeChannelConfiguration);
writer.write(ByteBuffer.wrap(jsonString.getBytes(Charsets.UTF_8)));
writer.close();
// Get load job
Job job = writer.getJob();
job = job.waitFor();
LoadStatistics stats = job.getStatistics();
long success = stats.getOutputRows();
StatementResult sr = new StatementResult(null, success,count - success);
al.add(sr);
} catch (IOException | InterruptedException | TimeoutException e) {
StatementResult sr = new StatementResult(e.getMessage(), 1,1);
al.add(sr);
} finally {
writer.close();
}
return al.iterator();However, the line Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |