icexelloss commented on code in PR #14386:
URL: https://github.com/apache/arrow/pull/14386#discussion_r993806477
##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -156,15 +156,23 @@ Result<ExecBatch> ExecBatch::Make(std::vector<Datum>
values) {
Result<std::shared_ptr<RecordBatch>> ExecBatch::ToRecordBatch(
std::shared_ptr<Schema> schema, MemoryPool* pool) const {
+ if (static_cast<size_t>(schema->num_fields()) > values.size()) {
+ return Status::Invalid("ExecBatch::ToTRecordBatch mismatching schema
size");
+ }
ArrayVector columns(schema->num_fields());
for (size_t i = 0; i < columns.size(); ++i) {
const Datum& value = values[i];
if (value.is_array()) {
columns[i] = value.make_array();
continue;
+ } else if (value.is_scalar()) {
Review Comment:
Hmm..when would a ExecBatch contains scalar value and why do we convert that
into array?
##########
cpp/src/arrow/compute/exec.cc:
##########
@@ -156,15 +156,23 @@ Result<ExecBatch> ExecBatch::Make(std::vector<Datum>
values) {
Result<std::shared_ptr<RecordBatch>> ExecBatch::ToRecordBatch(
std::shared_ptr<Schema> schema, MemoryPool* pool) const {
+ if (static_cast<size_t>(schema->num_fields()) > values.size()) {
+ return Status::Invalid("ExecBatch::ToTRecordBatch mismatching schema
size");
+ }
ArrayVector columns(schema->num_fields());
for (size_t i = 0; i < columns.size(); ++i) {
const Datum& value = values[i];
if (value.is_array()) {
columns[i] = value.make_array();
continue;
+ } else if (value.is_scalar()) {
Review Comment:
Hmm..when would a ExecBatch contain scalar value and why do we convert that
into array?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]