Skip to content

ORC-1399 [C++] Return LongVectorBatch when createRowBatch for boolean type with useTightNumericVector option - #1449

Merged
wgtmac merged 3 commits into
apache:mainfrom
ffacs:columnVectorBatch
Mar 27, 2023
Merged

wgtmac merged 3 commits into
apache:mainfrom
ffacs:columnVectorBatch

Conversation

@ffacs

@ffacs ffacs commented Mar 23, 2023

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Return LongVectorBatch when create a RowBatch for BOOLEAN type with useTightNumericVector option, instead of ByteVectorBatch.

Why are the changes needed?

If a ByteVectorBatch is returned, BooleanColumnReader/Writer would crash because they only accept LongVectorBatch.

How was this patch tested?

no test

@github-actions github-actions Bot added the CPP label Mar 23, 2023
@ffacs ffacs changed the title Fix mismatch behavior with option useTightNumericVector ORC-1399 [C++] Return LongVectorBatch when createRowBatch with useTightNumericVector option for boolean Mar 23, 2023
@ffacs ffacs changed the title ORC-1399 [C++] Return LongVectorBatch when createRowBatch with useTightNumericVector option for boolean ORC-1399 [C++] Return LongVectorBatch when createRowBatch for boolean type with useTightNumericVector option Mar 23, 2023
Comment thread c++/src/TypeImpl.cc Resolved
@dongjoon-hyun

Copy link
Copy Markdown
Member

cc @wgtmac

@ffacs

ffacs commented Mar 24, 2023 •

Copy link
Copy Markdown
Contributor Author

I ve uploaded a new patch which supports reading/writing ByteVectorBatch for BOOLEAN type, please take a look in your free time. @dongjoon-hyun @wgtmac @coderex2522

@wgtmac wgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall is looking good. Left some cosmetic comments.

Comment thread c++/src/ColumnWriter.cc Outdated
BatchType* byteBatch = dynamic_cast<BatchType*>(&rowBatch);
if (byteBatch == nullptr) {
throw InvalidArgument("Failed to cast to LongVectorBatch");
throw InvalidArgument("Failed to cast to BooleanVectorBatch");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exception message may be incorrect. You may need to #include <typeinfo> to use its name field to build the message.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread c++/src/ColumnReader.cc Outdated
Comment on lines +176 to +177
// Since the byte rle places the output in a char*
// we cheat here and use the other type and then expand it in a second pass.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Since the byte rle places the output in a char*
// we cheat here and use the other type and then expand it in a second pass.
// Since the byte rle places the output in a char* and BatchType here may be
// LongVectorBatch with long*. We cheat here in that case and use the long*
// and then expand it in a second pass.

@wgtmac wgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @ffacs!

@wgtmac
wgtmac merged commit 070c1a5 into apache:main Mar 27, 2023
@dongjoon-hyun dongjoon-hyun added this to the 1.9.0 milestone Mar 27, 2023
@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you, @ffacs and @wgtmac .

@ffacs
ffacs deleted the columnVectorBatch branch July 29, 2023 08:28
cxzl25 pushed a commit to cxzl25/orc that referenced this pull request Jan 11, 2024
### What changes were proposed in this pull request?
Fix using ByteVectorBatch for BOOLEAN type with useTightNumericVector enabled.

### Why are the changes needed?
If a ByteVectorBatch is returned, BooleanColumnReader/Writer would crash because they only accept LongVectorBatch.

This closes apache#1449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants