Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] Primitive concrete arrays could expose a span converter #37199

Closed
pitrou opened this issue Aug 16, 2023 · 7 comments · Fixed by #38027
Closed

[C++] Primitive concrete arrays could expose a span converter #37199

pitrou opened this issue Aug 16, 2023 · 7 comments · Fixed by #38027

Comments

@pitrou
Copy link
Member

pitrou commented Aug 16, 2023

Describe the enhancement requested

Just like we have PrimitiveArray::raw_values, we could also have something that returns a arrow::util::span for easier consumption:

  const util::span<value_type> values_span() const {
    return util::span(raw_values(), static_cast<size_t>(length_));
  }

Component(s)

C++

@pitrou
Copy link
Member Author

pitrou commented Aug 16, 2023

@bkietz @felipecrv

@mapleFU
Copy link
Member

mapleFU commented Aug 16, 2023

@jsjtxietian would you like to add this?

@jsjtxietian
Copy link
Contributor

Will do.

@chrisjordansquire
Copy link
Contributor

@jsjtxietian - Was this done / is this task still open?

@jsjtxietian
Copy link
Contributor

@chrisjordansquire Hi this task is still open. I went to one month vacation rightly after I took the task. I will do this likely before October.

@felipecrv
Copy link
Contributor

What about null values?

@pitrou
Copy link
Member Author

pitrou commented Sep 22, 2023

They would not be exposed here. The semantics would be similar to raw_values(). Perhaps there's a use case, perhaps not...

felipecrv pushed a commit that referenced this issue Dec 18, 2023
)

### Rationale for this change

Convenience. We can have such a helper at the buffer and array data level.

### What changes are included in this PR?

Add `Buffer::span_as`, `Buffer::mutuable_span_as`  and `ArraySpan::GetSpan`.

### Are these changes tested?

No,  but I'm happy to add some test if needed.

### Are there any user-facing changes?

Yes, new public functions.
* Closes: #37199

Authored-by: jsjtxietian <jsjtxietian@outlook.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
@felipecrv felipecrv added this to the 15.0.0 milestone Dec 18, 2023
clayburn pushed a commit to clayburn/arrow that referenced this issue Jan 23, 2024
apache#38027)

### Rationale for this change

Convenience. We can have such a helper at the buffer and array data level.

### What changes are included in this PR?

Add `Buffer::span_as`, `Buffer::mutuable_span_as`  and `ArraySpan::GetSpan`.

### Are these changes tested?

No,  but I'm happy to add some test if needed.

### Are there any user-facing changes?

Yes, new public functions.
* Closes: apache#37199

Authored-by: jsjtxietian <jsjtxietian@outlook.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this issue Feb 19, 2024
apache#38027)

### Rationale for this change

Convenience. We can have such a helper at the buffer and array data level.

### What changes are included in this PR?

Add `Buffer::span_as`, `Buffer::mutuable_span_as`  and `ArraySpan::GetSpan`.

### Are these changes tested?

No,  but I'm happy to add some test if needed.

### Are there any user-facing changes?

Yes, new public functions.
* Closes: apache#37199

Authored-by: jsjtxietian <jsjtxietian@outlook.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants