[
https://issues.apache.org/jira/browse/ORC-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16490301#comment-16490301
]
ASF GitHub Bot commented on ORC-343:
------------------------------------
Github user wgtmac commented on a diff in the pull request:
https://github.com/apache/orc/pull/273#discussion_r190800936
--- Diff: c++/src/RLE.cc ---
@@ -64,4 +66,55 @@ namespace orc {
}
}
+ void RleEncoder::add(const int64_t* data, uint64_t numValues,
+ const char* notNull) {
+ for (uint64_t i = 0; i < numValues; ++i) {
+ if (!notNull || notNull[i]) {
+ write(data[i]);
+ }
+ }
+ }
+
+ void RleEncoder::writeVslong(int64_t val) {
+ writeVulong((val << 1) ^ (val >> 63));
+ }
+
+ void RleEncoder::writeVulong(int64_t val) {
+ while (true) {
+ if ((val & ~0x7f) == 0) {
+ writeByte(static_cast<char>(val));
+ return;
+ } else {
+ writeByte(static_cast<char>(0x80 | (val & 0x7f)));
+ // cast val to unsigned so as to force 0-fill right shift
+ val = (static_cast<uint64_t>(val) >> 7);
+ }
+ }
+ }
+
+ void RleEncoder::writeByte(char c) {
+ if (bufferPosition == bufferLength) {
+ int addedSize = 0;
+ if (!outputStream->Next(reinterpret_cast<void **>(&buffer),
&addedSize)) {
+ throw std::bad_alloc();
+ }
+ bufferPosition = 0;
+ bufferLength = static_cast<size_t>(addedSize);
+ }
+ buffer[bufferPosition++] = c;
+ }
+
+ void RleEncoder::recordPosition(PositionRecorder* recorder) const {
--- End diff --
We haven't added support for writing index stream so far. Remove this
function for now and that should be in a separate change.
> Enable C++ writer to support RleV2
> ----------------------------------
>
> Key: ORC-343
> URL: https://issues.apache.org/jira/browse/ORC-343
> Project: ORC
> Issue Type: New Feature
> Components: C++
> Reporter: Yurui Zhou
> Priority: Major
>
> Currently only the Java implementation support RleV2 encoder, the C++
> implementation only support RleV2 decoding.
> The issue aims to enable the c++ writer to support RleV2 encoding.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)