Skip to content

Commit 7c29104

Browse files
authored
[Issue pixelsdb#830] sync the updates from mini-pixels (pixelsdb#832)
1 parent 61c60ef commit 7c29104

32 files changed

+667
-349
lines changed

cpp/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ deps:
4646
make -j install
4747

4848
clean:
49-
rm -rf build
49+
rm -rf build/release
50+
rm -rf build/debug
5051
cd pixels-duckdb/duckdb && make clean
5152

5253
# Main build

cpp/pixels-cli/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ set(pixels_cli_cxx
7676
lib/executor/LoadExecutor.cpp
7777
lib/load/Parameters.cpp
7878
lib/load/PixelsConsumer.cpp)
79+
7980
add_executable(pixels-cli ${pixels_cli_cxx})
8081
include_directories(include)
8182
include_directories(../pixels-core/include)

cpp/pixels-cli/lib/load/PixelsConsumer.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,9 @@ void PixelsConsumer::run()
6161
regex = " ";
6262
}
6363

64-
// int pixelsStride = std::stoi(ConfigFactory::Instance().getProperty("pixel.stride"));
65-
// int rowGroupSize = std::stoi(ConfigFactory::Instance().getProperty("row.group.size"));
66-
// int64_t blockSize = std::stoll(ConfigFactory::Instance().getProperty("block.size"));
67-
int pixelsStride = 2;
68-
int rowGroupSize = 100;
69-
int64_t blockSize = 1024;
64+
int pixelsStride = std::stoi(ConfigFactory::Instance().getProperty("pixel.stride"));
65+
int rowGroupSize = std::stoi(ConfigFactory::Instance().getProperty("row.group.size"));
66+
int64_t blockSize = std::stoll(ConfigFactory::Instance().getProperty("block.size"));
7067

7168
short replication = static_cast<short>(std::stoi(ConfigFactory::Instance().getProperty("block.replication")));
7269

@@ -109,16 +106,14 @@ void PixelsConsumer::run()
109106
if (initPixelsFile)
110107
{
111108
LocalFS targetStorage;
112-
targetFileName =
113-
std::to_string(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())) +
114-
".pxl";
109+
targetFileName = std::to_string(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())) + \
110+
"_" + std::to_string(this->loadedFiles.size()) + ".pxl";
115111
targetFilePath = targetPath + targetFileName;
116112
pixelsWriter = std::make_shared<PixelsWriterImpl>(schema, pixelsStride, rowGroupSize,
117113
targetFilePath, blockSize,
118114
true, encodingLevel, nullPadding, false, 1);
119115
}
120116
initPixelsFile = false;
121-
122117
++rowBatch->rowCount;
123118
++rowCounter;
124119

@@ -149,7 +144,7 @@ void PixelsConsumer::run()
149144
rowBatch->reset();
150145
}
151146

152-
// 创建一个新的文件
147+
// create a new file
153148
if (rowCounter >= maxRowNum)
154149
{
155150
if (rowBatch->rowCount != 0)
@@ -159,13 +154,14 @@ void PixelsConsumer::run()
159154
}
160155
pixelsWriter->close();
161156
this->loadedFiles.push_back(targetFilePath);
157+
std::cout << "Generate file: " << targetFilePath << std::endl;
162158
rowCounter = 0;
163159
initPixelsFile = true;
164160
}
165161
}
166162
}
167163
}
168-
// 剩余line写入文件
164+
// write the remaining lines
169165
if (rowCounter > 0)
170166
{
171167
if (rowBatch->rowCount != 0)

cpp/pixels-common/include/physical/Request.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class Request
3535
uint64_t start;
3636
uint64_t length;
3737

38-
Request(uint64_t queryId_, uint64_t start_, uint64_t length_, int64_t bufferId = -1);
38+
Request(uint64_t queryId_, uint64_t start_, uint64_t length_,
39+
int64_t bufferId = -1);
3940

4041
int hashCode();
4142

cpp/pixels-common/include/physical/natives/ByteBuffer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ class ByteBuffer
5858
uint8_t
5959
get(); // Relative get method. Reads the uint8_t at the buffers current position then increments the position
6060
uint8_t get(uint32_t index); // Absolute get method. Read uint8_t at index
61-
// this is the same as read(byte b[], int off, int len) in InputStream.java
6261
int getBufferOffset();
63-
6462
uint8_t *getBuffer();
65-
63+
// this is the same as read(byte b[], int off, int len) in InputStream.java
6664
int read(uint8_t *buffer, uint32_t off, uint32_t len);
6765

6866
void getBytes(uint8_t *buffer, uint32_t len); // Absolute read into array buf of length len

cpp/pixels-core/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ set(pixels_core_cxx
6262
lib/writer/TimestampColumnWriter.cpp
6363
lib/writer/DateColumnWriter.cpp
6464
include/writer/DateColumnWriter.h
65-
)
65+
include/utils/DynamicIntArray.h
66+
lib/utils/DynamicIntArray.cpp
67+
include/writer/StringColumnWriter.h
68+
lib/writer/StringColumnWriter.cpp
69+
)
6670

6771
add_library(pixels-core ${pixels_core_cxx})
6872

cpp/pixels-core/include/PixelsWriterImpl.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,5 @@ class PixelsWriterImpl : public PixelsWriter
8686
std::vector <pixels::proto::RowGroupStatistic> rowGroupStatisticList;
8787
std::shared_ptr <PhysicalWriter> physicalWriter;
8888
std::vector <std::shared_ptr<TypeDescription>> children;
89-
9089
};
9190
#endif //PIXELS_PIXELSWRITERIMPL_H

cpp/pixels-core/include/TypeDescription.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class TypeDescription : public std::enable_shared_from_this<TypeDescription>
7474
CHAR,
7575
STRUCT
7676
};
77+
7778
class StringPosition
7879
{
7980
friend class TypeDescription;

cpp/pixels-core/include/exception/PixelsFileVersionInvalidException.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define PIXELS_PIXELSRUNTIMEEXCEPTION_H
2727

2828
#include <exception>
29+
#include <cstdint>
2930
#include <string>
3031
#include <iostream>
3132
#include "PixelsVersion.h"

cpp/pixels-core/include/reader/PixelsRecordReaderImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,6 @@ class PixelsRecordReaderImpl : public PixelsRecordReader
149149
std::shared_ptr <TypeDescription> fileSchema;
150150
std::shared_ptr <TypeDescription> resultSchema;
151151
std::shared_ptr <VectorizedRowBatch> resultRowBatch;
152+
int asyncReadRequestNum{0};
152153
};
153154
#endif //PIXELS_PIXELSRECORDREADERIMPL_H

0 commit comments

Comments
 (0)