private void addAllRowsToResult(RowResultIterator it, int recordcount, List<String> querySchema, Vector<HashMap<String, ByteIterator>> result) throws Exception { RowResult row; HashMap<String, ByteIterator> rowResult = new HashMap<>(querySchema.size()); if (it == null) { return; } while (it.hasNext()) { if (result.size() == recordcount) { return; } row = it.next(); int colIdx = 0; for (String col : querySchema) { rowResult.put(col, new StringByteIterator(row.getString(colIdx))); colIdx++; } result.add(rowResult); } }
public static Slice getSlice(Type type, RowResult row, int field) { if (type instanceof VarcharType) { return Slices.utf8Slice(row.getString(field)); } else if (type instanceof VarbinaryType) { return Slices.wrappedBuffer(row.getBinary(field)); } else if (type instanceof DecimalType) { BigDecimal dec = row.getDecimal(field); return Decimals.encodeScaledValue(dec); } else { throw new IllegalStateException("getSlice not implemented for " + type); } } }
@Override public List<String> listSchemaNames(KuduClient client) { try { if (rawSchemasTable == null) { if (!client.tableExists(rawSchemasTableName)) { createAndFillSchemasTable(client); } rawSchemasTable = getSchemasTable(client); } KuduScanner scanner = client.newScannerBuilder(rawSchemasTable).build(); RowResultIterator iterator = scanner.nextRows(); ArrayList<String> result = new ArrayList<>(); while (iterator != null) { for (RowResult row : iterator) { result.add(row.getString(0)); } iterator = scanner.nextRows(); } return result; } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
return row.getString(field);
switch (schema.getColumnByIndex(i).getType()) { case STRING: to.addStringUtf8(i, from.getString(i).getBytes(StandardCharsets.UTF_8)); break; case INT64:
ByteBuffer value = ByteBuffer.wrap(result.getString(pci.index).getBytes()); if (pci.kuduColumn.isNullable()) { ((NullableVarCharVector.Mutator) pci.vv.getMutator())
return result.getByte(jpaColumnName); case STRING: return result.getString(jpaColumnName); case UNIXTIME_MICROS: default:
/** * Get the specified column's string. * @param columnName name of the column to get data for * @return a string * @throws IllegalArgumentException if the column doesn't exist, is null, * or if the type doesn't match the column's type */ public String getString(String columnName) { return getString(this.schema.getColumnIndex(columnName)); }
public static Slice getSlice(Type type, RowResult row, int field) { if (type instanceof VarcharType) { return Slices.utf8Slice(row.getString(field)); } else if (type instanceof VarbinaryType) { return Slices.wrappedBuffer(row.getBinary(field)); } else if (type instanceof DecimalType) { BigDecimal dec = row.getDecimal(field); return Decimals.encodeScaledValue(dec); } else { throw new IllegalStateException("getSlice not implemented for " + type); } } }
public static Slice getSlice(Type type, RowResult row, int field) { if (type instanceof VarcharType) { return Slices.utf8Slice(row.getString(field)); } else if (type instanceof VarbinaryType) { return Slices.wrappedBuffer(row.getBinary(field)); } else if (type instanceof DecimalType) { BigDecimal dec = row.getDecimal(field); return Decimals.encodeScaledValue(dec); } else { throw new IllegalStateException("getSlice not implemented for " + type); } } }
break; case STRING: values.add(result.getString(columnName)); break; case BOOL:
@Override public List<String> listSchemaNames(KuduClient client) { try { if (rawSchemasTable == null) { if (!client.tableExists(rawSchemasTableName)) { createAndFillSchemasTable(client); } rawSchemasTable = getSchemasTable(client); } KuduScanner scanner = client.newScannerBuilder(rawSchemasTable).build(); RowResultIterator iterator = scanner.nextRows(); ArrayList<String> result = new ArrayList<>(); while (iterator != null) { for (RowResult row : iterator) { result.add(row.getString(0)); } iterator = scanner.nextRows(); } return result; } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
@Override public List<String> listSchemaNames() { try { if (rawSchemasTable == null) { if (!client.tableExists(rawSchemasTableName)) { createAndFillSchemasTable(); } rawSchemasTable = getSchemasTable(); } ColumnSchema tenantColumn = rawSchemasTable.getSchema().getColumnByIndex(0); KuduScanner scanner = client.newScannerBuilder(rawSchemasTable) .addPredicate(KuduPredicate.newComparisonPredicate(tenantColumn, KuduPredicate.ComparisonOp.EQUAL, tenantPrefix)) .setProjectedColumnIndexes(ImmutableList.of(1)) .build(); RowResultIterator iterator = scanner.nextRows(); ArrayList<String> result = new ArrayList<>(); while (iterator != null) { for (RowResult row : iterator) { result.add(row.getString(0)); } iterator = scanner.nextRows(); } return result; } catch (KuduException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, e); } }
private static CINode getCINode(RowResult result, CINode node) { node.key = getStringFromKeys(result.getLong(0), result.getLong(1)); if (result.isNull(2) || result.isNull(3)) { node.prev = "NO_REFERENCE"; } else { node.prev = getStringFromKeys(result.getLong(2), result.getLong(3)); } node.rowId = result.getInt(4); node.client = result.getString(5); node.updateCount = result.getInt(6); return node; }
} else { if (type instanceof VarcharType) { return row.getString(field); } else if (type == TimestampType.TIMESTAMP) { return row.getLong(field) / 1000;
return row.getString(field);
switch (schema.getColumnByIndex(i).getType()) { case STRING: to.addStringUtf8(i, from.getString(i).getBytes(Charsets.UTF_8)); break; case INT64:
switch (schema.getColumnByIndex(i).getType()) { case STRING: to.addStringUtf8(i, from.getString(i).getBytes(StandardCharsets.UTF_8)); break; case INT64:
assertEquals(magicNumber, rr.getInt(1)); assertEquals(magicNumber, rr.getInt(2)); assertEquals(magicNumber + "", rr.getString(3)); assertEquals(false, rr.getBoolean(4));