Skip to content

Commit 5152df2

Browse files
author
Jennifer Baldwin
committed
merge OTF-920
1 parent 5911f15 commit 5152df2

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

arrow/src/main/java/org/apache/iceberg/arrow/vectorized/GenericArrowVectorAccessorFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ private ArrowVectorAccessor<DecimalT, Utf8StringT, ArrayT, ChildVectorT> getPlai
231231
return new FixedSizeBinaryAccessor<>(
232232
(FixedSizeBinaryVector) vector, stringFactorySupplier.get());
233233
}
234-
throw new UnsupportedOperationException("Unsupported vector: " + vector.getClass());
234+
String vectorName = (vector == null) ? "null" : vector.getClass().toString();
235+
throw new UnsupportedOperationException("Unsupported vector: " + vectorName);
235236
}
236237

237238
private static boolean isDecimal(PrimitiveType primitive) {

arrow/src/test/java/org/apache/iceberg/arrow/vectorized/TestArrowReader.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import static org.apache.iceberg.Files.localInput;
2222
import static org.assertj.core.api.Assertions.assertThat;
23+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
2324

2425
import java.io.File;
2526
import java.io.IOException;
@@ -272,6 +273,51 @@ public void testReadColumnFilter2() throws Exception {
272273
scan, NUM_ROWS_PER_MONTH, 12 * NUM_ROWS_PER_MONTH, ImmutableList.of("timestamp"));
273274
}
274275

276+
@Test
277+
public void testThrowsUOEWhenNewColumnHasNoValue() throws Exception {
278+
rowsWritten = Lists.newArrayList();
279+
tables = new HadoopTables();
280+
281+
Schema schema =
282+
new Schema(
283+
Types.NestedField.required(1, "a", Types.IntegerType.get()),
284+
Types.NestedField.optional(2, "b", Types.StringType.get()),
285+
Types.NestedField.required(3, "c", Types.DecimalType.of(12, 3)));
286+
287+
PartitionSpec spec = PartitionSpec.builderFor(schema).build();
288+
Table table1 = tables.create(schema, spec, tableLocation);
289+
290+
// Add one record to the table
291+
GenericRecord rec = GenericRecord.create(schema);
292+
rec.setField("a", 1);
293+
rec.setField("b", "san diego");
294+
rec.setField("c", new BigDecimal("1024.025"));
295+
List<GenericRecord> genericRecords = Lists.newArrayList();
296+
genericRecords.add(rec);
297+
298+
// Alter the table schema by adding a new, optional column.
299+
// Do not add any data for this new column in the one existing row in the table
300+
// and do not insert any new rows into the table.
301+
Table table = tables.load(tableLocation);
302+
table.updateSchema().addColumn("a1", Types.IntegerType.get()).commit();
303+
304+
// Select all columns, all rows from the table
305+
TableScan scan = table.newScan().select("*");
306+
307+
assertThatThrownBy(
308+
() -> {
309+
// Read the data.
310+
try (VectorizedTableScanIterable itr =
311+
new VectorizedTableScanIterable(scan, 1000, false)) {
312+
for (ColumnarBatch batch : itr) {
313+
// no-op
314+
}
315+
}
316+
})
317+
.isInstanceOf(UnsupportedOperationException.class)
318+
.hasMessage("Unsupported vector: null");
319+
}
320+
275321
/**
276322
* The test asserts that {@link CloseableIterator#hasNext()} returned by the {@link ArrowReader}
277323
* is idempotent.

aws/src/main/java/org/apache/iceberg/aws/lakeformation/LakeFormationAwsClientFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ protected String buildTableArn() {
141141

142142
private LakeFormationClient lakeFormation() {
143143
return LakeFormationClient.builder()
144-
.applyMutation(this::applyAssumeRoleConfigurations)
145-
.applyMutation(httpClientProperties()::applyHttpClientConfigurations)
146-
.build();
144+
.applyMutation(this::applyAssumeRoleConfigurations)
145+
.applyMutation(httpClientProperties()::applyHttpClientConfigurations)
146+
.build();
147147
}
148148

149149
protected AwsCredentialsProvider lakeFormationCredentialsProvider() {

0 commit comments

Comments
 (0)