Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions cpp/src/arrow/array-test.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -1080,19 +1080,19 @@ TEST_F(TestBinaryArray, LengthZeroCtor) {
}

// ----------------------------------------------------------------------
// FixedWidthBinary tests
// FixedSizeBinary tests

class TestFWBinaryArray : public ::testing::Test {
public:
void SetUp() {}

void InitBuilder(int byte_width) {
auto type = fixed_width_binary(byte_width);
builder_.reset(new FixedWidthBinaryBuilder(default_memory_pool(), type));
auto type = fixed_size_binary(byte_width);
builder_.reset(new FixedSizeBinaryBuilder(default_memory_pool(), type));
}

protected:
std::unique_ptr<FixedWidthBinaryBuilder> builder_;
std::unique_ptr<FixedSizeBinaryBuilder> builder_;
};

TEST_F(TestFWBinaryArray, Builder) {
Expand All@@ -1114,7 +1114,7 @@ TEST_F(TestFWBinaryArray, Builder) {
auto CheckResult = [this, &length, &is_valid, &raw_data, &byte_width](
const Array& result) {
// Verify output
const auto& fw_result = static_cast<const FixedWidthBinaryArray&>(result);
const auto& fw_result = static_cast<const FixedSizeBinaryArray&>(result);

ASSERT_EQ(length, result.length());

Expand DownExpand Up@@ -1169,9 +1169,9 @@ TEST_F(TestFWBinaryArray, Builder) {
TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
// Check that we don't compare data in null slots

auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder1(default_memory_pool(), type);
FixedWidthBinaryBuilder builder2(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder1(default_memory_pool(), type);
FixedSizeBinaryBuilder builder2(default_memory_pool(), type);

ASSERT_OK(builder1.Append("foo1"));
ASSERT_OK(builder1.AppendNull());
Expand All@@ -1183,19 +1183,19 @@ TEST_F(TestFWBinaryArray, EqualsRangeEquals) {
ASSERT_OK(builder1.Finish(&array1));
ASSERT_OK(builder2.Finish(&array2));

const auto& a1 = static_cast<const FixedWidthBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedWidthBinaryArray&>(*array2);
const auto& a1 = static_cast<const FixedSizeBinaryArray&>(*array1);
const auto& a2 = static_cast<const FixedSizeBinaryArray&>(*array2);

FixedWidthBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedWidthBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal1(type, 2, a1.data(), a1.null_bitmap(), 1);
FixedSizeBinaryArray equal2(type, 2, a2.data(), a1.null_bitmap(), 1);

ASSERT_TRUE(equal1.Equals(equal2));
ASSERT_TRUE(equal1.RangeEquals(equal2, 0, 2, 0));
}

TEST_F(TestFWBinaryArray, ZeroSize) {
auto type = fixed_width_binary(0);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(0);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

ASSERT_OK(builder.Append(nullptr));
ASSERT_OK(builder.Append(nullptr));
Expand All@@ -1207,7 +1207,7 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
std::shared_ptr<Array> array;
ASSERT_OK(builder.Finish(&array));

const auto& fw_array = static_cast<const FixedWidthBinaryArray&>(*array);
const auto& fw_array = static_cast<const FixedSizeBinaryArray&>(*array);

// data is never allocated
ASSERT_TRUE(fw_array.data() == nullptr);
Expand All@@ -1218,8 +1218,8 @@ TEST_F(TestFWBinaryArray, ZeroSize) {
}

TEST_F(TestFWBinaryArray, Slice) {
auto type = fixed_width_binary(4);
FixedWidthBinaryBuilder builder(default_memory_pool(), type);
auto type = fixed_size_binary(4);
FixedSizeBinaryBuilder builder(default_memory_pool(), type);

vector<string> strings = {"foo1", "foo2", "foo3", "foo4", "foo5"};
vector<uint8_t> is_null = {0, 1, 0, 0, 0};
Expand Down
11 changes: 5 additions & 6 deletions cpp/src/arrow/array.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -280,18 +280,17 @@ std::shared_ptr<Array> StringArray::Slice(int64_t offset, int64_t length) const
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryArray::FixedWidthBinaryArray(const std::shared_ptr<DataType>& type,
FixedSizeBinaryArray::FixedSizeBinaryArray(const std::shared_ptr<DataType>& type,
int64_t length, const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap, int64_t null_count, int64_t offset)
: PrimitiveArray(type, length, data, null_bitmap, null_count, offset) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

std::shared_ptr<Array> FixedWidthBinaryArray::Slice(
int64_t offset, int64_t length) const {
std::shared_ptr<Array> FixedSizeBinaryArray::Slice(int64_t offset, int64_t length) const {
ConformSliceParams(offset_, length_, &offset, &length);
return std::make_shared<FixedWidthBinaryArray>(
return std::make_shared<FixedSizeBinaryArray>(
type_, length, data_, null_bitmap_, kUnknownNullCount, offset);
}

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/array.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -347,11 +347,11 @@ class ARROW_EXPORT StringArray : public BinaryArray {
// ----------------------------------------------------------------------
// Fixed width binary

class ARROW_EXPORT FixedWidthBinaryArray : public PrimitiveArray {
class ARROW_EXPORT FixedSizeBinaryArray : public PrimitiveArray {
public:
using TypeClass = FixedWidthBinaryType;
using TypeClass = FixedSizeBinaryType;

FixedWidthBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
FixedSizeBinaryArray(const std::shared_ptr<DataType>& type, int64_t length,
const std::shared_ptr<Buffer>& data,
const std::shared_ptr<Buffer>& null_bitmap = nullptr, int64_t null_count = 0,
int64_t offset = 0);
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/builder.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -438,51 +438,51 @@ Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
// ----------------------------------------------------------------------
// Fixed width binary

FixedWidthBinaryBuilder::FixedWidthBinaryBuilder(
FixedSizeBinaryBuilder::FixedSizeBinaryBuilder(
MemoryPool* pool, const std::shared_ptr<DataType>& type)
: ArrayBuilder(pool, type), byte_builder_(pool) {
DCHECK(type->type == Type::FIXED_WIDTH_BINARY);
byte_width_ = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
DCHECK(type->type == Type::FIXED_SIZE_BINARY);
byte_width_ = static_cast<const FixedSizeBinaryType&>(*type).byte_width();
}

Status FixedWidthBinaryBuilder::Append(const uint8_t* value) {
Status FixedSizeBinaryBuilder::Append(const uint8_t* value) {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(true);
return byte_builder_.Append(value, byte_width_);
}

Status FixedWidthBinaryBuilder::Append(
Status FixedSizeBinaryBuilder::Append(
const uint8_t* data, int64_t length, const uint8_t* valid_bytes) {
RETURN_NOT_OK(Reserve(length));
UnsafeAppendToBitmap(valid_bytes, length);
return byte_builder_.Append(data, length * byte_width_);
}

Status FixedWidthBinaryBuilder::Append(const std::string& value) {
Status FixedSizeBinaryBuilder::Append(const std::string& value) {
return Append(reinterpret_cast<const uint8_t*>(value.c_str()));
}

Status FixedWidthBinaryBuilder::AppendNull() {
Status FixedSizeBinaryBuilder::AppendNull() {
RETURN_NOT_OK(Reserve(1));
UnsafeAppendToBitmap(false);
return byte_builder_.Advance(byte_width_);
}

Status FixedWidthBinaryBuilder::Init(int64_t elements) {
Status FixedSizeBinaryBuilder::Init(int64_t elements) {
DCHECK_LT(elements, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(ArrayBuilder::Init(elements));
return byte_builder_.Resize(elements * byte_width_);
}

Status FixedWidthBinaryBuilder::Resize(int64_t capacity) {
Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
DCHECK_LT(capacity, std::numeric_limits<int64_t>::max());
RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
return ArrayBuilder::Resize(capacity);
}

Status FixedWidthBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
Status FixedSizeBinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<Buffer> data = byte_builder_.Finish();
*out = std::make_shared<FixedWidthBinaryArray>(
*out = std::make_shared<FixedSizeBinaryArray>(
type_, length_, data, null_bitmap_, null_count_);
return Status::OK();
}
Expand DownExpand Up@@ -542,7 +542,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
BUILDER_CASE(DOUBLE, DoubleBuilder);
BUILDER_CASE(STRING, StringBuilder);
BUILDER_CASE(BINARY, BinaryBuilder);
BUILDER_CASE(FIXED_WIDTH_BINARY, FixedWidthBinaryBuilder);
BUILDER_CASE(FIXED_SIZE_BINARY, FixedSizeBinaryBuilder);
case Type::LIST: {
std::shared_ptr<ArrayBuilder> value_builder;
std::shared_ptr<DataType> value_type =
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/builder.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -390,11 +390,11 @@ class ARROW_EXPORT StringBuilder : public BinaryBuilder {
};

// ----------------------------------------------------------------------
// FixedWidthBinaryBuilder
// FixedSizeBinaryBuilder

class ARROW_EXPORT FixedWidthBinaryBuilder : public ArrayBuilder {
class ARROW_EXPORT FixedSizeBinaryBuilder : public ArrayBuilder {
public:
FixedWidthBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);
FixedSizeBinaryBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type);

Status Append(const uint8_t* value);
Status Append(
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compare.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -202,8 +202,8 @@ class RangeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& left) {
const auto& right = static_cast<const FixedWidthBinaryArray&>(right_);
Status Visit(const FixedSizeBinaryArray& left) {
const auto& right = static_cast<const FixedSizeBinaryArray&>(right_);

int32_t width = left.byte_width();

Expand DownExpand Up@@ -648,8 +648,8 @@ class TypeEqualsVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryType& left) {
const auto& right = static_cast<const FixedWidthBinaryType&>(right_);
Status Visit(const FixedSizeBinaryType& left) {
const auto& right = static_cast<const FixedSizeBinaryType&>(right_);
result_ = left.byte_width() == right.byte_width();
return Status::OK();
}
Expand Down
24 changes: 12 additions & 12 deletions cpp/src/arrow/ipc/json-internal.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,7 +189,7 @@ class JsonSchemaWriter {
}
}

void WriteTypeMetadata(const FixedWidthBinaryType& type) {
void WriteTypeMetadata(const FixedSizeBinaryType& type) {
writer_->Key("byteWidth");
writer_->Int(type.byte_width());
}
Expand DownExpand Up@@ -297,8 +297,8 @@ class JsonSchemaWriter {

Status Visit(const BinaryType& type) { return WriteVarBytes("binary", type); }

Status Visit(const FixedWidthBinaryType& type) {
return WritePrimitive("fixedwidthbinary", type);
Status Visit(const FixedSizeBinaryType& type) {
return WritePrimitive("fixedsizebinary", type);
}

Status Visit(const TimestampType& type) { return WritePrimitive("timestamp", type); }
Expand DownExpand Up@@ -401,7 +401,7 @@ class JsonArrayWriter {
}
}

void WriteDataValues(const FixedWidthBinaryArray& arr) {
void WriteDataValues(const FixedSizeBinaryArray& arr) {
int32_t width = arr.byte_width();
for (int64_t i = 0; i < arr.length(); ++i) {
const char* buf = reinterpret_cast<const char*>(arr.GetValue(i));
Expand DownExpand Up@@ -576,13 +576,13 @@ static Status GetFloatingPoint(
return Status::OK();
}

static Status GetFixedWidthBinary(
static Status GetFixedSizeBinary(
const RjObject& json_type, std::shared_ptr<DataType>* type) {
const auto& json_byte_width = json_type.FindMember("byteWidth");
RETURN_NOT_INT("byteWidth", json_byte_width, json_type);

int32_t byte_width = json_byte_width->value.GetInt();
*type = fixed_width_binary(byte_width);
*type = fixed_size_binary(byte_width);
return Status::OK();
}

Expand DownExpand Up@@ -709,8 +709,8 @@ static Status GetType(const RjObject& json_type,
*type = utf8();
} else if (type_name == "binary") {
*type = binary();
} else if (type_name == "fixedwidthbinary") {
return GetFixedWidthBinary(json_type, type);
} else if (type_name == "fixedsizebinary") {
return GetFixedSizeBinary(json_type, type);
} else if (type_name == "null") {
*type = null();
} else if (type_name == "date") {
Expand DownExpand Up@@ -896,10 +896,10 @@ class JsonArrayReader {
}

template <typename T>
typename std::enable_if<std::is_base_of<FixedWidthBinaryType, T>::value, Status>::type
typename std::enable_if<std::is_base_of<FixedSizeBinaryType, T>::value, Status>::type
ReadArray(const RjObject& json_array, int32_t length, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& type, std::shared_ptr<Array>* array) {
FixedWidthBinaryBuilder builder(pool_, type);
FixedSizeBinaryBuilder builder(pool_, type);

const auto& json_data = json_array.FindMember("DATA");
RETURN_NOT_ARRAY("DATA", json_data, json_array);
Expand All@@ -908,7 +908,7 @@ class JsonArrayReader {

DCHECK_EQ(static_cast<int32_t>(json_data_arr.Size()), length);

int32_t byte_width = static_cast<const FixedWidthBinaryType&>(*type).byte_width();
int32_t byte_width = static_cast<const FixedSizeBinaryType&>(*type).byte_width();

// Allocate space for parsed values
std::shared_ptr<MutableBuffer> byte_buffer;
Expand DownExpand Up@@ -1112,7 +1112,7 @@ class JsonArrayReader {
TYPE_CASE(DoubleType);
TYPE_CASE(StringType);
TYPE_CASE(BinaryType);
TYPE_CASE(FixedWidthBinaryType);
TYPE_CASE(FixedSizeBinaryType);
TYPE_CASE(Date32Type);
TYPE_CASE(Date64Type);
TYPE_CASE(TimestampType);
Expand Down
14 changes: 7 additions & 7 deletions cpp/src/arrow/ipc/metadata.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -230,9 +230,9 @@ static Status TypeFromFlatbuffer(flatbuf::Type type, const void* type_data,
case flatbuf::Type_Binary:
*out = binary();
return Status::OK();
case flatbuf::Type_FixedWidthBinary: {
auto fw_binary = static_cast<const flatbuf::FixedWidthBinary*>(type_data);
*out = fixed_width_binary(fw_binary->byteWidth());
case flatbuf::Type_FixedSizeBinary: {
auto fw_binary = static_cast<const flatbuf::FixedSizeBinary*>(type_data);
*out = fixed_size_binary(fw_binary->byteWidth());
return Status::OK();
}
case flatbuf::Type_Utf8:
Expand DownExpand Up@@ -362,10 +362,10 @@ static Status TypeToFlatbuffer(FBB& fbb, const std::shared_ptr<DataType>& type,
*out_type = flatbuf::Type_FloatingPoint;
*offset = FloatToFlatbuffer(fbb, flatbuf::Precision_DOUBLE);
break;
case Type::FIXED_WIDTH_BINARY: {
const auto& fw_type = static_cast<const FixedWidthBinaryType&>(*type);
*out_type = flatbuf::Type_FixedWidthBinary;
*offset = flatbuf::CreateFixedWidthBinary(fbb, fw_type.byte_width()).Union();
case Type::FIXED_SIZE_BINARY: {
const auto& fw_type = static_cast<const FixedSizeBinaryType&>(*type);
*out_type = flatbuf::Type_FixedSizeBinary;
*offset = flatbuf::CreateFixedSizeBinary(fbb, fw_type.byte_width()).Union();
} break;
case Type::BINARY:
*out_type = flatbuf::Type_Binary;
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/ipc/test-common.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -599,14 +599,14 @@ void AppendValues(const std::vector<bool>& is_valid, const std::vector<T>& value

Status MakeFWBinary(std::shared_ptr<RecordBatch>* out) {
std::vector<bool> is_valid = {true, true, true, false};
auto f0 = field("f0", fixed_width_binary(4));
auto f1 = field("f1", fixed_width_binary(0));
auto f0 = field("f0", fixed_size_binary(4));
auto f1 = field("f1", fixed_size_binary(0));
std::shared_ptr<Schema> schema(new Schema({f0, f1}));

std::shared_ptr<Array> a1, a2;

FixedWidthBinaryBuilder b1(default_memory_pool(), f0->type);
FixedWidthBinaryBuilder b2(default_memory_pool(), f1->type);
FixedSizeBinaryBuilder b1(default_memory_pool(), f0->type);
FixedSizeBinaryBuilder b2(default_memory_pool(), f1->type);

std::vector<std::string> values1 = {"foo1", "foo2", "foo3", "foo4"};
AppendValues(is_valid, values1, &b1);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/ipc/writer.cc
Original file line numberDiff line numberDiff line change
Expand Up@@ -269,7 +269,7 @@ class RecordBatchWriter : public ArrayVisitor {
return Status::OK();
}

Status Visit(const FixedWidthBinaryArray& array) override {
Status Visit(const FixedSizeBinaryArray& array) override {
auto data = array.data();
int32_t width = array.byte_width();

Expand Down
Loading