public Boolean getBoolean(int idx) { return (Boolean) getValue(idx); }
public Double getDouble(int idx) { return (Double) getValue(idx); }
public Float getFloat(int idx) { return (Float) getValue(idx); }
public Date getDate(String colName) { return (Date) getValue(colName); }
public List<?> getList(int idx) { return (List<?>) getValue(idx); }
public List<?> getStruct(int idx) { return (List<?>) getValue(idx); }
public Boolean getBoolean(String colName) { return (Boolean) getValue(colName); }
public Short getShort(String colName) { return (Short) getValue(colName); }
public Integer getInt(String colName) { return (Integer) getValue(colName); }
public Long getLong(int idx) { return (Long) getValue(idx); }
public Long getLong(String colName) { return (Long) getValue(colName); }
public Timestamp getTimestamp(String colName) { return (Timestamp) getValue(colName); }
public Integer getInt(int idx) { return (Integer) getValue(idx); }
public Timestamp getTimestamp(int idx) { return (Timestamp) getValue(idx); }
public BigDecimal getDecimal(int idx) { return (BigDecimal) getValue(idx); }
public List<?> getList(String colName) { return (List<?>) getValue(colName); }
public Map<?, ?> getMap(int idx) { return (Map<?, ?>) getValue(idx); }
public Object getValue(String colName) { Integer idx = nameToIndexMapping.get(colName); Preconditions.checkArgument(idx != null); return getValue(idx); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("["); for (int idx = 0; idx < schema.getColumns().size(); ++idx) { if (idx > 0) { sb.append(", "); } Object val = getValue(idx); sb.append(val == null ? "null" : val.toString()); } sb.append("]"); return sb.toString(); } }
private static void printRow(Row row) { Schema schema = row.getSchema(); StringBuilder sb = new StringBuilder(); int length = schema.getColumns().size(); for (int idx = 0; idx < length; ++idx) { sb.append(row.getValue(idx)); if (idx != length - 1) { sb.append(", "); } } System.out.println(sb.toString()); }