MCPcopy Create free account
hub / github.com/apache/arrow / ASSERT_OK_AND_ASSIGN

Function ASSERT_OK_AND_ASSIGN

cpp/src/parquet/column_writer_test.cc:1976–2382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1974 ASSERT_THAT(key_value_metadata, NotNull());
1975 ASSERT_EQ(2, key_value_metadata->size());
1976 ASSERT_OK_AND_ASSIGN(auto value, key_value_metadata->Get("hello"));
1977 ASSERT_EQ("world", value);
1978 ASSERT_OK_AND_ASSIGN(value, key_value_metadata->Get("bye"));
1979 ASSERT_EQ("moon", value);
1980}
1981
1982TEST_F(TestInt32Writer, ResetKeyValueMetadata) {
1983 auto writer = this->BuildWriter();
1984 writer->AddKeyValueMetadata(KeyValueMetadata::Make({"hello"}, {"world"}));
1985 writer->ResetKeyValueMetadata();
1986 writer->Close();
1987 auto key_value_metadata = metadata_key_value_metadata();
1988 ASSERT_THAT(key_value_metadata, IsNull());
1989}
1990
1991TEST_F(TestInt32Writer, WriteKeyValueMetadataEndToEnd) {
1992 auto sink = CreateOutputStream();
1993 {
1994 auto file_writer = ParquetFileWriter::Open(
1995 sink, std::dynamic_pointer_cast<schema::GroupNode>(schema_.schema_root()));
1996 auto rg_writer = file_writer->AppendRowGroup();
1997 auto col_writer = rg_writer->NextColumn();
1998 col_writer->AddKeyValueMetadata(KeyValueMetadata::Make({"foo"}, {"bar"}));
1999 file_writer->Close();
2000 }
2001 ASSERT_OK_AND_ASSIGN(auto buffer, sink->Finish());
2002 auto file_reader =
2003 ParquetFileReader::Open(std::make_shared<::arrow::io::BufferReader>(buffer));
2004 auto key_value_metadata =
2005 file_reader->metadata()->RowGroup(0)->ColumnChunk(0)->key_value_metadata();
2006 ASSERT_THAT(key_value_metadata, NotNull());
2007 ASSERT_EQ(1U, key_value_metadata->size());
2008 ASSERT_OK_AND_ASSIGN(auto value, key_value_metadata->Get("foo"));
2009 ASSERT_EQ("bar", value);
2010}
2011
2012TEST_F(TestValuesWriterInt32Type, AllNullsCompressionInPageV2) {
2013 // GH-31992: In DataPageV2, the levels and data will not be compressed together,
2014 // so, when all values are null, the compressed values should be empty. And
2015 // we should handle this case correctly.
2016 std::vector<Compression::type> compressions = {Compression::SNAPPY, Compression::GZIP,
2017 Compression::ZSTD, Compression::BROTLI,
2018 Compression::LZ4};
2019 for (auto compression : compressions) {
2020 if (!Codec::IsAvailable(compression)) {
2021 continue;
2022 }
2023 ARROW_SCOPED_TRACE("compression = ", Codec::GetCodecAsString(compression));
2024 // Optional and non-repeated, with definition levels
2025 // but no repetition levels
2026 this->SetUpSchema(Repetition::OPTIONAL);
2027 this->GenerateData(SMALL_SIZE);
2028 std::fill(this->def_levels_.begin(), this->def_levels_.end(), 0);
2029 ColumnProperties column_properties;
2030 column_properties.set_compression(compression);
2031
2032 auto writer =
2033 this->BuildWriter(SMALL_SIZE, column_properties, ParquetVersion::PARQUET_2_LATEST,

Callers 15

WriteTestDataMethod · 0.70
TESTFunction · 0.70
WriteFileMethod · 0.70
TEST_FFunction · 0.70
SetUpMethod · 0.70
SetUpMethod · 0.70
GenerateInputDataMethod · 0.70
TESTFunction · 0.70
CheckDirectPutMethod · 0.70
TestPageSerdeCrcMethod · 0.70

Calls 15

CreateOutputStreamFunction · 0.85
TestColumnNameFunction · 0.85
MakeWKBPointFunction · 0.85
GetWKBPointCoordinateXYFunction · 0.85
BytesToBitsFunction · 0.85
BytesForBitsFunction · 0.85
ClearBitFunction · 0.85
ResetKeyValueMetadataMethod · 0.80
metadata_num_valuesMethod · 0.80
is_compressedMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected