Skip to content

Commit ca3b460

Browse files
author
xiao.dong
committed
fix header include&other comments
1 parent 6b07e7f commit ca3b460

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
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.cc)
87+
avro/avro_stream_internal.cc)
8888

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

src/iceberg/avro/avro_stream.cc renamed to src/iceberg/avro/avro_stream_internal.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
* under the License.
1818
*/
1919

20-
#include "avro_stream.h"
20+
#include "avro_stream_internal.h"
2121

2222
#include <format>
2323

2424
#include <arrow/result.h>
25-
#include <iceberg/exception.h>
25+
26+
#include "iceberg/exception.h"
2627

2728
namespace iceberg::avro {
2829

File renamed without changes.

test/avro_stream_test.cc

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
#include <arrow/filesystem/localfs.h>
2121
#include <arrow/result.h>
2222
#include <gtest/gtest.h>
23-
#include <iceberg/arrow/arrow_fs_file_io.h>
24-
#include <iceberg/avro/avro_stream.h>
2523

24+
#include "iceberg/avro/avro_stream_internal.h"
2625
#include "temp_file_test_base.h"
2726

2827
namespace iceberg::avro {
@@ -31,15 +30,12 @@ class AVROStreamTest : public TempFileTestBase {
3130
public:
3231
void SetUp() override {
3332
TempFileTestBase::SetUp();
34-
file_io_ = std::make_shared<iceberg::arrow::ArrowFileSystemFileIO>(
35-
std::make_shared<::arrow::fs::LocalFileSystem>());
3633
temp_filepath_ = CreateNewTempFilePath();
3734
local_fs_ = std::make_shared<::arrow::fs::LocalFileSystem>();
3835
}
3936

4037
std::shared_ptr<AvroOutputStream> CreateOutputStream(const std::string& path,
4138
int64_t buffer_size) {
42-
std::cout << "CreateOutputStream" << path << std::endl;
4339
auto arrow_out_ret = local_fs_->OpenOutputStream(path);
4440
if (!arrow_out_ret.ok()) {
4541
throw std::runtime_error("Failed to open output stream: " +
@@ -51,7 +47,6 @@ class AVROStreamTest : public TempFileTestBase {
5147

5248
std::shared_ptr<AvroInputStream> CreateInputStream(const std::string& path,
5349
int64_t buffer_size) {
54-
std::cout << "CreateInputStream" << path << std::endl;
5550
auto arrow_in_ret = local_fs_->OpenInputFile(path);
5651
if (!arrow_in_ret.ok()) {
5752
throw std::runtime_error("Failed to open input stream: " +
@@ -87,7 +82,6 @@ class AVROStreamTest : public TempFileTestBase {
8782

8883
int64_t buffer_size_ = 1024;
8984
std::shared_ptr<::arrow::fs::LocalFileSystem> local_fs_;
90-
std::shared_ptr<iceberg::FileIO> file_io_;
9185
std::string temp_filepath_;
9286
};
9387

@@ -98,17 +92,15 @@ TEST_F(AVROStreamTest, TestAvroBasicStream) {
9892
WriteDataToStream(avro_output_stream, test_data);
9993

10094
auto avro_input_stream = CreateInputStream(temp_filepath_, buffer_size_);
101-
{
102-
const uint8_t* data{};
103-
size_t len{};
104-
ASSERT_TRUE(avro_input_stream->next(&data, &len));
105-
EXPECT_EQ(len, test_data.size());
10695

107-
EXPECT_EQ(avro_input_stream->byteCount(), test_data.size());
108-
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data), len), test_data);
109-
std::cout << std::string(reinterpret_cast<const char*>(data), len) << std::endl;
110-
ASSERT_FALSE(avro_input_stream->next(&data, &len));
111-
}
96+
const uint8_t* data{};
97+
size_t len{};
98+
ASSERT_TRUE(avro_input_stream->next(&data, &len));
99+
EXPECT_EQ(len, test_data.size());
100+
101+
EXPECT_EQ(avro_input_stream->byteCount(), test_data.size());
102+
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data), len), test_data);
103+
ASSERT_FALSE(avro_input_stream->next(&data, &len));
112104
}
113105

114106
TEST_F(AVROStreamTest, InputStreamBackup) {
@@ -137,7 +129,7 @@ TEST_F(AVROStreamTest, InputStreamBackup) {
137129
ASSERT_TRUE(avro_input_stream->next(&data, &len));
138130
EXPECT_EQ(len, backupSize);
139131
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data), len),
140-
test_data.substr(test_data.size() - backupSize)); // NOLINT
132+
test_data.substr(test_data.size() - backupSize));
141133

142134
// Check that we've reached the end of the stream
143135
ASSERT_FALSE(avro_input_stream->next(&data, &len));
@@ -165,7 +157,7 @@ TEST_F(AVROStreamTest, InputStreamSkip) {
165157
ASSERT_TRUE(avro_input_stream->next(&data, &len));
166158
EXPECT_EQ(len, test_data.size() - skipSize);
167159
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data), len),
168-
test_data.substr(skipSize)); // NOLINT
160+
test_data.substr(skipSize));
169161

170162
// Check that we've reached the end of the stream
171163
ASSERT_FALSE(avro_input_stream->next(&data, &len));
@@ -193,7 +185,7 @@ TEST_F(AVROStreamTest, InputStreamSeek) {
193185
ASSERT_TRUE(avro_input_stream->next(&data, &len));
194186
EXPECT_EQ(len, test_data.size() - seekPos);
195187
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data), len),
196-
test_data.substr(seekPos)); // NOLINT
188+
test_data.substr(seekPos));
197189

198190
// Check that we've reached the end of the stream
199191
ASSERT_FALSE(avro_input_stream->next(&data, &len));

0 commit comments

Comments
 (0)