Skip to content

Commit 6b07e7f

Browse files
author
xiao.dong
committed
add more case and independ stream test
1 parent 52f073f commit 6b07e7f

File tree

6 files changed

+378
-99
lines changed

6 files changed

+378
-99
lines changed

src/iceberg/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ if(ICEBERG_BUILD_BUNDLE)
8484
arrow/arrow_fs_file_io.cc
8585
avro/demo_avro.cc
8686
avro/avro_schema_util.cc
87-
avro/avro_stream.cpp)
87+
avro/avro_stream.cc)
8888

8989
# Libraries to link with exported libiceberg_bundle.{so,a}.
9090
set(ICEBERG_BUNDLE_STATIC_BUILD_INTERFACE_LIBS)
File renamed without changes.

src/iceberg/avro/avro_stream.h

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,38 +31,26 @@ class AvroInputStream : public ::avro::SeekableInputStream {
3131

3232
~AvroInputStream() override;
3333

34-
/**
35-
* Returns some of available data.
36-
*
37-
* Returns true if some data is available, false if no more data is
38-
* available or an error has occurred.
39-
*/
34+
/// \brief Returns some of available data.
35+
/// \return true if some data is available, false if no more data is available or an
36+
/// error has occurred.
4037
bool next(const uint8_t** data, size_t* len) override;
4138

42-
/**
43-
* "Returns" back some of the data to the stream. The returned
44-
* data must be less than what was obtained in the last call to
45-
* next().
46-
*/
39+
/// \brief "Returns" back some of the data to the stream. The returned data must be less
40+
/// than what was obtained in the last call to next().
4741
void backup(size_t len) override;
4842

49-
/**
50-
* Skips number of bytes specified by len.
51-
*/
43+
/// \brief Skips number of bytes specified by len.
5244
void skip(size_t len) override;
5345

54-
/**
55-
* Returns the number of bytes read from this stream so far.
56-
* All the bytes made available through next are considered
57-
* to be used unless, returned back using backup.
58-
*/
46+
/// \brief Returns the number of bytes read from this stream so far.
47+
/// All the bytes made available through next are considered to be used unless,
48+
/// returned back using backup.
5949
size_t byteCount() const override;
6050

61-
/**
62-
* Seek to a specific position in the stream. This may invalidate pointers
63-
* returned from next(). This will also reset byteCount() to the given
64-
* position.
65-
*/
51+
/// \brief Seek to a specific position in the stream. This may invalidate pointers
52+
/// returned from next(). This will also reset byteCount() to the given
53+
/// position.
6654
void seek(int64_t position) override;
6755

6856
private:
@@ -81,30 +69,22 @@ class AvroOutputStream : public ::avro::OutputStream {
8169

8270
~AvroOutputStream() override;
8371

84-
/**
85-
* Returns a buffer that can be written into.
86-
* On successful return, data has the pointer to the buffer
87-
* and len has the number of bytes available at data.
88-
*/
72+
/// \brief Returns a buffer that can be written into.
73+
/// On successful return, data has the pointer to the buffer
74+
/// and len has the number of bytes available at data.
8975
bool next(uint8_t** data, size_t* len) override;
9076

91-
/**
92-
* "Returns" back to the stream some of the buffer obtained
93-
* from in the last call to next().
94-
*/
77+
/// \brief "Returns" back to the stream some of the buffer obtained
78+
/// from in the last call to next().
9579
void backup(size_t len) override;
9680

97-
/**
98-
* Number of bytes written so far into this stream. The whole buffer
99-
* returned by next() is assumed to be written unless some of
100-
* it was returned using backup().
101-
*/
81+
/// \brief Number of bytes written so far into this stream. The whole buffer
82+
/// returned by next() is assumed to be written unless some of
83+
/// it was returned using backup().
10284
uint64_t byteCount() const override;
10385

104-
/**
105-
* Flushes any data remaining in the buffer to the stream's underlying
106-
* store, if any.
107-
*/
86+
/// \brief Flushes any data remaining in the buffer to the stream's underlying
87+
/// store, if any.
10888
void flush() override;
10989

11090
private:

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ add_test(NAME util_test COMMAND util_test)
6565

6666
if(ICEBERG_BUILD_BUNDLE)
6767
add_executable(avro_test)
68-
target_sources(avro_test PRIVATE avro_test.cc avro_schema_test.cc)
68+
target_sources(avro_test PRIVATE avro_test.cc avro_schema_test.cc avro_stream_test.cc)
6969
target_link_libraries(avro_test PRIVATE iceberg_bundle_static GTest::gtest_main
7070
GTest::gmock)
7171
add_test(NAME avro_test COMMAND avro_test)

0 commit comments

Comments
 (0)