Skip to content

Commit 00a13ef

Browse files
committed
Remove C++ dataset test
This duplicates the Python test so we don't really need both.
1 parent e6ad2c4 commit 00a13ef

File tree

1 file changed

+0
-92
lines changed

1 file changed

+0
-92
lines changed

cpp/src/arrow/dataset/file_parquet_encryption_test.cc

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -432,97 +432,5 @@ TEST_P(LargeRowCountEncryptionTest, ReadEncryptLargeRowCount) {
432432
INSTANTIATE_TEST_SUITE_P(LargeRowCountEncryptionTest, LargeRowCountEncryptionTest,
433433
kAllParamValues);
434434

435-
TEST(DatasetEncryption, WriteWithSelectedColumnStatistics) {
436-
ASSERT_OK_AND_ASSIGN(auto file_system, fs::internal::MockFileSystem::Make(
437-
std::chrono::system_clock::now(), {}));
438-
ASSERT_OK(file_system->CreateDir(std::string(kBaseDir)));
439-
440-
// Configure encryption
441-
std::unordered_map<std::string, SecureString> key_map;
442-
key_map.emplace(kColumnMasterKeyId, kColumnMasterKey);
443-
key_map.emplace(kFooterKeyMasterKeyId, kFooterKeyMasterKey);
444-
445-
auto crypto_factory = std::make_shared<parquet::encryption::CryptoFactory>();
446-
auto kms_client_factory =
447-
std::make_shared<parquet::encryption::TestOnlyInMemoryKmsClientFactory>(
448-
/*wrap_locally=*/true, key_map);
449-
crypto_factory->RegisterKmsClientFactory(std::move(kms_client_factory));
450-
auto kms_connection_config =
451-
std::make_shared<parquet::encryption::KmsConnectionConfig>();
452-
453-
auto encryption_config = std::make_shared<parquet::encryption::EncryptionConfiguration>(
454-
std::string(kFooterKeyName));
455-
encryption_config->uniform_encryption = true;
456-
457-
auto parquet_encryption_config = std::make_shared<ParquetEncryptionConfig>();
458-
459-
parquet_encryption_config->crypto_factory = crypto_factory;
460-
parquet_encryption_config->kms_connection_config = kms_connection_config;
461-
parquet_encryption_config->encryption_config = std::move(encryption_config);
462-
463-
// Configure Parquet file format, setting encryption and
464-
// making statistics only enabled for specific column.
465-
auto file_format = std::make_shared<ParquetFileFormat>();
466-
467-
auto parquet_file_write_options =
468-
checked_pointer_cast<ParquetFileWriteOptions>(file_format->DefaultWriteOptions());
469-
auto writer_properties = std::make_unique<parquet::WriterProperties::Builder>()
470-
->disable_statistics()
471-
->enable_statistics("a")
472-
->enable_statistics("b")
473-
->build();
474-
475-
parquet_file_write_options->parquet_encryption_config =
476-
std::move(parquet_encryption_config);
477-
parquet_file_write_options->writer_properties = std::move(writer_properties);
478-
479-
// Create test data
480-
auto table_schema =
481-
schema({field("a", int64()), field("b", int64()), field("c", int64())});
482-
auto table = TableFromJSON(table_schema, {R"([
483-
[ 0, 9, 1 ],
484-
[ 1, 8, 2 ],
485-
[ 2, 7, 1 ],
486-
[ 3, 6, 2 ],
487-
[ 4, 5, 1 ],
488-
[ 5, 4, 2 ],
489-
[ 6, 3, 1 ],
490-
[ 7, 2, 2 ],
491-
[ 8, 1, 1 ],
492-
[ 9, 0, 2 ]
493-
])"});
494-
495-
// Write dataset
496-
auto dataset = std::make_shared<InMemoryDataset>(table);
497-
ASSERT_OK_AND_ASSIGN(auto scanner_builder, dataset->NewScan());
498-
ARROW_EXPECT_OK(scanner_builder->UseThreads(false));
499-
500-
ASSERT_OK_AND_ASSIGN(auto scanner, scanner_builder->Finish());
501-
FileSystemDatasetWriteOptions write_options;
502-
write_options.file_write_options = parquet_file_write_options;
503-
write_options.filesystem = file_system;
504-
write_options.base_dir = kBaseDir;
505-
write_options.basename_template = "part{i}.parquet";
506-
write_options.partitioning = std::make_shared<DirectoryPartitioning>(schema({}));
507-
ASSERT_OK(FileSystemDataset::Write(write_options, std::move(scanner)));
508-
509-
// Get written file
510-
ASSERT_OK_AND_ASSIGN(auto input_file, file_system->OpenInputFile("part0.parquet"));
511-
auto reader_properties = ::parquet::default_reader_properties();
512-
auto decryption_config =
513-
std::make_shared<parquet::encryption::DecryptionConfiguration>();
514-
515-
auto decryption_properties = crypto_factory->GetFileDecryptionProperties(
516-
*kms_connection_config, *decryption_config);
517-
reader_properties.file_decryption_properties(decryption_properties);
518-
auto parquet_file = ::parquet::ParquetFileReader::Open(input_file, reader_properties);
519-
520-
// Verify only expected columns have statistics set
521-
auto row_group = parquet_file->metadata()->RowGroup(0);
522-
ASSERT_NE(row_group->ColumnChunk(0)->statistics(), nullptr);
523-
ASSERT_NE(row_group->ColumnChunk(1)->statistics(), nullptr);
524-
ASSERT_EQ(row_group->ColumnChunk(2)->statistics(), nullptr);
525-
}
526-
527435
} // namespace dataset
528436
} // namespace arrow

0 commit comments

Comments
 (0)