本文整理汇总了Java中com.google.api.services.bigquery.model.TableCell类的典型用法代码示例。如果您正苦于以下问题:Java TableCell类的具体用法?Java TableCell怎么用?Java TableCell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableCell类属于com.google.api.services.bigquery.model包,在下文中一共展示了TableCell类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: next
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
@Override
public TableRow next() {
if (nextLine == null) {
throw new NoSuchElementException();
}
String result = nextLine;
List<TableCell> cellList = new ArrayList<TableCell>();
Matcher matcher = CVS_ELEMENT_PATTERN.matcher(result);
while (matcher.find()) {
TableCell resultCell = new TableCell();
resultCell.setV(matcher.group());
cellList.add(resultCell);
}
TableRow resultRow = new TableRow();
resultRow.setF(cellList);
// For next
fetch();
return resultRow;
}
开发者ID:kamiru78,项目名称:be-bigquery,代码行数:20,代码来源:TableRowsGcsStream.java
示例2: createResponseContainingTestData
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
private QueryResponse createResponseContainingTestData() {
TableCell field1 = new TableCell();
field1.setV("abc");
TableCell field2 = new TableCell();
field2.setV("2");
TableCell field3 = new TableCell();
field3.setV("testing BigQuery matcher.");
TableRow row = new TableRow();
row.setF(Lists.newArrayList(field1, field2, field3));
QueryResponse response = new QueryResponse();
response.setJobComplete(true);
response.setRows(Lists.newArrayList(row));
response.setTotalRows(BigInteger.ONE);
return response;
}
开发者ID:apache,项目名称:beam,代码行数:17,代码来源:BigqueryMatcherTest.java
示例3: printRows
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
public static String printRows(final GetQueryResultsResponse response) {
StringBuilder msg = null;
msg = new StringBuilder();
try {
for (TableFieldSchema schem: response.getSchema().getFields()) {
msg.append(schem.getName());
msg.append(TAB);
}
msg.append(NEWLINE);
for (TableRow row : response.getRows()) {
for (TableCell field : row.getF()) {
msg.append(field.getV().toString());
msg.append(TAB);
}
msg.append(NEWLINE);
}
return msg.toString();
} catch ( NullPointerException ex ) {
throw new NullPointerException("SQL Execution returned an error!");
}
}
开发者ID:apache,项目名称:zeppelin,代码行数:22,代码来源:BigQueryInterpreter.java
示例4: rawRow
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
private TableRow rawRow(Object...args) {
List<TableCell> cells = new LinkedList<>();
for (Object a : args) {
cells.add(new TableCell().setV(a));
}
return new TableRow().setF(cells);
}
开发者ID:apache,项目名称:beam,代码行数:8,代码来源:BigQueryUtilTest.java
示例5: generateHash
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
private String generateHash(@Nonnull List<TableRow> rows) {
List<HashCode> rowHashes = Lists.newArrayList();
for (TableRow row : rows) {
List<String> cellsInOneRow = Lists.newArrayList();
for (TableCell cell : row.getF()) {
cellsInOneRow.add(Objects.toString(cell.getV()));
Collections.sort(cellsInOneRow);
}
rowHashes.add(
Hashing.sha1().hashString(cellsInOneRow.toString(), StandardCharsets.UTF_8));
}
return Hashing.combineUnordered(rowHashes).toString();
}
开发者ID:apache,项目名称:beam,代码行数:14,代码来源:BigqueryMatcher.java
示例6: formatRows
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
private String formatRows(int totalNumRows) {
StringBuilder samples = new StringBuilder();
List<TableRow> rows = response.getRows();
for (int i = 0; i < totalNumRows && i < rows.size(); i++) {
samples.append(String.format("%n\t\t"));
for (TableCell field : rows.get(i).getF()) {
samples.append(String.format("%-10s", field.getV()));
}
}
if (rows.size() > totalNumRows) {
samples.append(String.format("%n\t\t..."));
}
return samples.toString();
}
开发者ID:apache,项目名称:beam,代码行数:15,代码来源:BigqueryMatcher.java
示例7: getQueryResults
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
/**
* Returns the query results for the given job as an ImmutableTable, row-keyed by row number
* (indexed from 1), column-keyed by the TableFieldSchema for that field, and with the value
* object as the cell value. Note that null values will not actually be null (since we're using
* ImmutableTable) but they can be checked for using Data.isNull().
*
* <p>This table is fully materialized in memory (not lazily loaded), so it should not be used
* with queries expected to return large results.
*/
private ImmutableTable<Integer, TableFieldSchema, Object> getQueryResults(Job job) {
try {
ImmutableTable.Builder<Integer, TableFieldSchema, Object> builder =
new ImmutableTable.Builder<>();
String pageToken = null;
int rowNumber = 1;
while (true) {
GetQueryResultsResponse queryResults = bigquery.jobs()
.getQueryResults(getProjectId(), job.getJobReference().getJobId())
.setPageToken(pageToken)
.execute();
// If the job isn't complete yet, retry; getQueryResults() waits for up to 10 seconds on
// each invocation so this will effectively poll for completion.
if (queryResults.getJobComplete()) {
List<TableFieldSchema> schemaFields = queryResults.getSchema().getFields();
for (TableRow row : queryResults.getRows()) {
Iterator<TableFieldSchema> fieldIterator = schemaFields.iterator();
Iterator<TableCell> cellIterator = row.getF().iterator();
while (fieldIterator.hasNext() && cellIterator.hasNext()) {
builder.put(rowNumber, fieldIterator.next(), cellIterator.next().getV());
}
rowNumber++;
}
pageToken = queryResults.getPageToken();
if (pageToken == null) {
break;
}
}
}
return builder.build();
} catch (IOException e) {
throw BigqueryJobFailureException.create(e);
}
}
开发者ID:google,项目名称:nomulus,代码行数:44,代码来源:BigqueryConnection.java
示例8: printRows
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
public static void printRows(List<TableRow> rows, PrintStream out){
for (TableRow row : rows) {
for (TableCell field : row.getF()) {
out.printf("%-50s", field.getV());
}
out.println();
}
}
开发者ID:googlearchive,项目名称:bigquery-samples-python,代码行数:9,代码来源:BigqueryUtils.java
示例9: getObject
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object getObject(int columnIndex) throws SQLException {
// to make the logfiles smaller!
//logger.debug("Function call getObject columnIndex is: " + String.valueOf(columnIndex));
this.closestrm();
if (this.isClosed()) {
throw new BQSQLException("This Resultset is Closed");
}
this.ThrowCursorNotValidExeption();
if (this.RowsofResult == null) {
throw new BQSQLException("There are no rows in this Resultset");
}
if (this.getMetaData().getColumnCount() < columnIndex
|| columnIndex < 1) {
throw new BQSQLException("ColumnIndex is not valid");
}
String Columntype = this.Result.getSchema().getFields()
.get(columnIndex - 1).getType();
TableCell field = ((TableRow) this.RowsofResult[this.Cursor]).getF().get(columnIndex - 1);
if (Data.isNull(field.getV())) {
this.wasnull = true;
return null;
} else {
String result = field.getV().toString();
this.wasnull = false;
try {
if (Columntype.equals("STRING")) {
//removing the excess byte by the setmaxFiledSize
if (maxFieldSize == 0 || maxFieldSize == Integer.MAX_VALUE) {
return result;
} else {
try { //lets try to remove the excess bytes
return result.substring(0, maxFieldSize);
} catch (IndexOutOfBoundsException iout) {
//we don't need to remove any excess byte
return result;
}
}
}
if (Columntype.equals("FLOAT")) {
return Float.parseFloat(result);
}
if (Columntype.equals("BOOLEAN")) {
return Boolean.parseBoolean(result);
}
if (Columntype.equals("INTEGER")) {
return Long.parseLong(result);
}
if (Columntype.equals("TIMESTAMP")) {
long val = new BigDecimal(result).longValue() * 1000;
return new Timestamp(val);
}
throw new BQSQLException("Unsupported Type (" + Columntype + ")");
} catch (NumberFormatException e) {
throw new BQSQLException(e);
}
}
}
开发者ID:jonathanswenson,项目名称:starschema-bigquery-jdbc,代码行数:62,代码来源:BQResultSet.java
示例10: getObject
import com.google.api.services.bigquery.model.TableCell; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object getObject(int columnIndex) throws SQLException {
// to make the logfiles smaller!
//logger.debug("Function call getObject columnIndex is: " + String.valueOf(columnIndex));
this.closestrm();
if (this.isClosed()) {
throw new BQSQLException("This Resultset is Closed");
}
this.ThrowCursorNotValidExeption();
if (this.RowsofResult == null) {
throw new BQSQLException("There are no rows in this Resultset");
}
if (this.getMetaData().getColumnCount() < columnIndex
|| columnIndex < 1) {
throw new BQSQLException("ColumnIndex is not valid");
}
String Columntype = this.Result.getSchema().getFields()
.get(columnIndex - 1).getType();
TableCell field = ((TableRow) this.RowsofResult[this.Cursor]).getF().get(columnIndex - 1);
if (Data.isNull(field.getV())) {
this.wasnull = true;
return null;
} else {
String result = field.getV().toString();
this.wasnull = false;
try {
if (Columntype.equals("STRING")) {
//removing the excess byte by the setmaxFiledSize
if (maxFieldSize == 0 || maxFieldSize == Integer.MAX_VALUE) {
return result;
} else {
try { //lets try to remove the excess bytes
return result.substring(0, maxFieldSize);
} catch (IndexOutOfBoundsException iout) {
//we don't need to remove any excess byte
return result;
}
}
}
if (Columntype.equals("FLOAT")) {
return Float.parseFloat(result);
}
if (Columntype.equals("BOOLEAN")) {
return Boolean.parseBoolean(result);
}
if (Columntype.equals("INTEGER")) {
return Long.parseLong(result);
}
if (Columntype.equals("TIMESTAMP")) {
long val = new BigDecimal(result).longValue() * 1000;
return new Timestamp(val);
}
throw new BQSQLException("Unsupported Type");
} catch (NumberFormatException e) {
throw new BQSQLException(e);
}
}
}
开发者ID:jonathanswenson,项目名称:starschema-bigquery-jdbc,代码行数:62,代码来源:BQScrollableResultSet.java
注:本文中的com.google.api.services.bigquery.model.TableCell类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论