public Boolean getBoolean(int idx) { return (Boolean) getValue(idx); }
@Override public Row createValue() { return new Row(schema); }
@Test public void testUsage() { Schema schema = createTestSchema(); Row row = new Row(schema); row.setValue(0, isNullCol0 ? null : col0); row.setValue(1, isNullCol1 ? null : col1); assertTrue(row.getValue(0) == null); assertTrue(row.getValue("col0") == null); } else { assertTrue(row.getValue(0) != null); assertEquals(col0, row.getValue(0)); assertEquals(col0, row.getValue("col0")); assertTrue(row.getValue(1) == null); assertTrue(row.getValue("col1") == null); } else { assertTrue(row.getValue(1) != null); assertEquals(col1, row.getValue(1)); assertEquals(col1, row.getValue("col1"));
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()); }
protected static void setRowFromStruct(Row row, Object structVal, StructObjectInspector soi) { Schema structSchema = row.getSchema(); // Add struct field data to the Row List<? extends StructField> structFields = soi.getAllStructFieldRefs(); for (int idx = 0; idx < structFields.size(); ++idx) { StructField structField = structFields.get(idx); Object convertedFieldValue = convertValue( soi.getStructFieldData(structVal, structField), structField.getFieldObjectInspector()); row.setValue(idx, convertedFieldValue); } }
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()); }
protected static void setRowFromStruct(Row row, Object structVal, StructObjectInspector soi) { Schema structSchema = row.getSchema(); // Add struct field data to the Row List<? extends StructField> structFields = soi.getAllStructFieldRefs(); for (int idx = 0; idx < structFields.size(); ++idx) { StructField structField = structFields.get(idx); Object convertedFieldValue = convertValue( soi.getStructFieldData(structVal, structField), structField.getFieldObjectInspector()); row.setValue(idx, convertedFieldValue); } }
public Double getDouble(int idx) { return (Double) getValue(idx); }
@Override public Row createValue() { return new Row(schema); }
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 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 Byte getByte(String colName) { return (Byte) getValue(colName); }