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

Union encoding #49

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Union encoding #49

wants to merge 2 commits into from

Conversation

samuelcolvin
Copy link
Collaborator

No description provided.

Comment on lines +220 to +225
boolean: c[1].as_any().downcast_ref::<BooleanArray>().cloned()?,
int: c[2].as_any().downcast_ref::<Int64Array>().cloned()?,
float: c[3].as_any().downcast_ref::<Float64Array>().cloned()?,
string: c[4].as_any().downcast_ref::<StringArray>().cloned()?,
array: c[5].as_any().downcast_ref::<StringArray>().cloned()?,
object: c[6].as_any().downcast_ref::<StringArray>().cloned()?,
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems like allowing the downcasts to fail here is unnecessary due to the is_json_union check.

Suggested change
boolean: c[1].as_any().downcast_ref::<BooleanArray>().cloned()?,
int: c[2].as_any().downcast_ref::<Int64Array>().cloned()?,
float: c[3].as_any().downcast_ref::<Float64Array>().cloned()?,
string: c[4].as_any().downcast_ref::<StringArray>().cloned()?,
array: c[5].as_any().downcast_ref::<StringArray>().cloned()?,
object: c[6].as_any().downcast_ref::<StringArray>().cloned()?,
boolean: c[1].as_boolean().clone(),
int: c[2].as_primitive().clone(),
float: c[3].as_primitive().clone(),
string: c[4].as_string().clone(),
array: c[5].as_string().clone(),
object: c[6].as_string().clone(),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants