Skip to content

Conversation

@lidavidm
Copy link
Member

@lidavidm lidavidm commented May 24, 2021

ScalarFromJSON(int64(), "null") == Datum(Int64Scalar())
ScalarFromJSON(int64(), "5")    == Datum(Int64Scalar(5))

@github-actions
Copy link

@bkietz bkietz changed the title ARROW-12859: [C++] Add DatumFromJSON for testing ARROW-12859: [C++] Add ScalarFromJSON for testing May 25, 2021
Copy link
Member

Choose a reason for hiding this comment

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

This approach might be worthwhile for consistency's sake, but we could also use Scalar::CastTo

@pitrou
Copy link
Member

pitrou commented Jun 1, 2021

Is there anything left to do here?

@lidavidm
Copy link
Member Author

lidavidm commented Jun 1, 2021

Is there anything left to do here?

I don't think so unless we really want to use Scalar::CastTo here.

@pitrou
Copy link
Member

pitrou commented Jun 1, 2021

Can you explain the Scalar::CastTo suggestion? I think I'm missing something.

Also, I notice this isn't actually tested? Perhaps add a test alongside those for ArrayFromJSON. And ensure that a non-1 length array would return an error?

@lidavidm
Copy link
Member Author

lidavidm commented Jun 1, 2021

For CastTo: I think it was actually the Cast kernel (string->type cast).

I added some basic tests. I don't think there's a good way to hit the DCHECK because that would imply a JSON value converter appended two array values for a single JSON value.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants