-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support Arrow on 1.9+ via pkg extension (#274)
* support Arrow on 1.9+ via pkg extension * bump Julia compat to 1.9 * Revert "bump Julia compat to 1.9" This reverts commit 13dfdc9. * 1.6 compat
- Loading branch information
Showing
4 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "JSON3" | ||
uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" | ||
authors = ["Jacob Quinn <[email protected]>"] | ||
version = "1.13.2" | ||
version = "1.14.0" | ||
|
||
[deps] | ||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
|
@@ -12,13 +12,22 @@ StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4" | |
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" | ||
|
||
[compat] | ||
ArrowTypes = "2.2" | ||
Parsers = "0.3, 1, 2" | ||
PrecompileTools = "1" | ||
StructTypes = "1.10" | ||
julia = "1.6" | ||
PrecompileTools = "1" | ||
|
||
[extensions] | ||
JSON3ArrowExt = ["ArrowTypes"] | ||
|
||
[extras] | ||
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45" | ||
ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] | ||
test = ["Arrow", "Test"] | ||
|
||
[weakdeps] | ||
ArrowTypes = "31f734f8-188a-4ce0-8406-c8a06bd891cd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module JSON3ArrowExt | ||
|
||
using JSON3 | ||
using ArrowTypes | ||
|
||
const JSON3_ARROW_NAME = Symbol("JuliaLang.JSON3.Object") | ||
|
||
# It might looks strange to have this as a StructKind when JSON objects are | ||
# very dict-like, but the valtype is Any, which Arrow.jl really not like | ||
# and even if we add a | ||
# toarrow(d::JSON3.Object) d = Dict{String, Union{typeof.(values(d))...} | ||
# that does not seem to solve the problem. | ||
ArrowTypes.ArrowKind(::Type{<:JSON3.Object}) = ArrowTypes.StructKind() | ||
ArrowTypes.arrowname(::Type{<:JSON3.Object}) = JSON3_ARROW_NAME | ||
ArrowTypes.JuliaType(::Val{JSON3_ARROW_NAME}) = JSON3.Object | ||
|
||
end # module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Arrow | ||
|
||
obj1 = JSON3.read(""" | ||
{ | ||
"int": 1, | ||
"float": 2.1 | ||
} | ||
""") | ||
|
||
obj2 = JSON3.read(""" | ||
{ | ||
"int": 1, | ||
"float": 2.1, | ||
"bool1": true, | ||
"bool2": false, | ||
"none": null, | ||
"str": "\\"hey there sailor\\"", | ||
"arr": [null, 1, "hey"], | ||
"arr2": [1.2, 3.4, 5.6] | ||
} | ||
""") | ||
|
||
obj3 = JSON3.read(""" | ||
{ | ||
"int": 1, | ||
"float": 2.1, | ||
"bool1": true, | ||
"bool2": false, | ||
"none": null, | ||
"str": "\\"hey there sailor\\"", | ||
"obj": { | ||
"a": 1, | ||
"b": null, | ||
"c": [null, 1, "hey"], | ||
"d": [1.2, 3.4, 5.6] | ||
}, | ||
"arr": [null, 1, "hey"], | ||
"arr2": [1.2, 3.4, 5.6] | ||
} | ||
""") | ||
|
||
tbl = (; json=[obj1, obj2, obj3]) | ||
|
||
arrow = Arrow.Table(Arrow.tobuffer(tbl)) | ||
@test tbl.json == arrow.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6429ada
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register()
6429ada
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/97146
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: