Skip to content

Commit

Permalink
Lint + small style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anjakefala committed Dec 1, 2023
1 parent aeef75a commit 3c69cdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions cpp/src/arrow/compute/kernels/scalar_cast_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2105,10 +2105,13 @@ TEST(Cast, BinaryToString) {
ASSERT_NE(invalid_utf8->data()->buffers[1].get(), strings->data()->buffers[2].get());
ASSERT_TRUE(invalid_utf8->data()->buffers[1]->Equals(*strings->data()->buffers[2]));

// ARROW-35901: check that casting with first buffer being a `nullptr` works
// GH-35901: check that casting a sliced array
// when first buffer's data is a `nullptr`
auto fixed_array_null = ArrayFromJSON(from_type, "[\"123\", \"245\", \"345\"]");
fixed_array_null = fixed_array_null->Slice(1, 1);
fixed_array_null->data()->buffers[0] = std::make_shared<Buffer>(nullptr,0);
fixed_array_null->data()->buffers[0] = std::make_shared<Buffer>(nullptr, 0);

ASSERT_OK(fixed_array_null->ValidateFull());
CheckCast(fixed_array_null, ArrayFromJSON(string_type, "[\"245\"]"));
}
}
Expand Down
8 changes: 4 additions & 4 deletions python/pyarrow/tests/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,22 +1972,22 @@ def test_write_csv_decimal(tmpdir, type_factory):
assert out.column('col').cast(type) == table.column('col')


# GH-35901
def test_large_binary_write_to_csv(tmpdir):
data_size = int(1E6)
file_name = tmpdir / "fixedsize_"+str(data_size)+".csv"
file_name = tmpdir / f"fixedsize_{data_size}.csv"

nparr = np.frombuffer(np.random.randint(65, 91, data_size, 'u1'), 'S4')

fixed_arr = pa.array(nparr, pa.binary(4))
fixed_table = pa.Table.from_arrays([fixed_arr], names=['fixedsize'])

write_options = WriteOptions(include_header=True, batch_size=2048,
delimiter='|')
write_options = WriteOptions(include_header=True, batch_size=2048)
write_csv(fixed_table, file_name, write_options=write_options)

assert os.path.exists(file_name)

parse_options = ParseOptions(delimiter="|")
parse_options = ParseOptions()
convert_options = ConvertOptions(column_types={"fixedsize": pa.binary(4)},
quoted_strings_can_be_null=False)
read_options = ReadOptions(block_size=2048)
Expand Down

0 comments on commit 3c69cdb

Please sign in to comment.