Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions cpp/src/jni/dataset/jni_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_arrow_dataset_jni_JniWrapper_createScann
JniAssertOkOrThrow(scanner_builder->Pool(pool));

std::vector<std::string> column_vector = ToStringVector(env, columns);
if (!column_vector.empty()) {
JniAssertOkOrThrow(scanner_builder->Project(column_vector));
}
JniAssertOkOrThrow(scanner_builder->Project(column_vector));
JniAssertOkOrThrow(scanner_builder->BatchSize(batch_size));
// initialize filters
jsize exprs_len = env->GetArrayLength(filter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,27 @@ public void testParquetProjector() throws Exception {
AutoCloseables.close(factory);
}

@Test
public void testEmptyProjector() throws Exception {
ParquetWriteSupport writeSupport = ParquetWriteSupport.writeTempFile(AVRO_SCHEMA_USER, TMP.newFolder(), 1, "a",
2, "b");

FileSystemDatasetFactory factory = new FileSystemDatasetFactory(rootAllocator(), NativeMemoryPool.getDefault(),
FileFormat.PARQUET, writeSupport.getOutputURI());
ScanOptions options = new ScanOptions(new String[]{}, Filter.EMPTY, 100);
Schema schema = inferResultSchemaFromFactory(factory, options);
List<ArrowRecordBatch> datum = collectResultFromFactory(factory, options);
org.apache.avro.Schema expectedSchema = truncateAvroSchema(writeSupport.getAvroSchema(), 0, 1);

assertSingleTaskProduced(factory, options);
assertEquals(0, schema.getFields().size());
assertEquals(1, datum.size());

AutoCloseables.close(datum);
AutoCloseables.close(factory);
}


@Test
public void testParquetBatchSize() throws Exception {
ParquetWriteSupport writeSupport = ParquetWriteSupport.writeTempFile(AVRO_SCHEMA_USER, TMP.newFolder(),
Expand Down