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

Port view to C++ #452

Merged
merged 8 commits into from
Feb 27, 2019
Merged

Port view to C++ #452

merged 8 commits into from
Feb 27, 2019

Conversation

sc1f
Copy link
Contributor

@sc1f sc1f commented Feb 25, 2019

This PR ports the view class to C++ in order to enhance portability and allow for more flexible language bindings.

JS Changes

  • table.prototype.view refactored to pass the config into C++
  • Checks for psp_okey for column-only views now use view.column_only
  • Test in internal.js has been marked skip due to change in how we handle incorrect arity aggregates - reenable?

C++ changes

  • View class holds aggregates, pivots, filters, sorts, and a t_config object
  • t_config has new constructors and members oriented towards view creation
  • make_context is no longer exposed to emscripten
  • get_aggspecs, get_fterms, get_sortspec now handle the parsing of config options
  • added utility to_string/from_string methods for aggregate and filter enums in base.h

Python tests do not pass at the moment because function bindings in binding.h have been changed. I'm starting the PR as a place where we can review + talk about these changes in the codebase.

@timkpaine
Copy link
Member

the python binding needs a lot of work before it can be fully usable, in the mean time so long as the tests pass feel free to comment out as needed and i'll reimplement later

@@ -280,6 +312,137 @@ filter_op_to_str(t_filter_op op) {
return "";
}

t_filter_op
str_to_filter_op(std::string str) {
if (str == "<") {
Copy link
Member

Choose a reason for hiding this comment

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

don't like switch statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can’t switch on a string in C++, so it was this or write another enum that gets mapped to the original enum.

Copy link
Member

Choose a reason for hiding this comment

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

you can do some stuff, but I think what you've done here is more readable and fine.

Copy link
Member

@timkpaine timkpaine left a comment

Choose a reason for hiding this comment

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

Fixed via commit

@timkpaine
Copy link
Member

@sc1f @texodus good to go, we should consider adding some more CPP linting. I also think @sc1f should add C++ tests for these blocks (even if they're still being tested from JS), so we have a good sense for how to use them when it comes time to extend the other bindings.

sc1f and others added 8 commits February 27, 2019 02:30
Move pivot table operations to C++

move set_depth calls into emscripten.cpp

rebase on cpp-subproject

move agg + filter to_string methods into base.cpp
Move aggregate and filter parsing to C++

Move aggregate parsing to c++
Construct the View in C++

Fix column pivot issues

Make sure that filters work with typed-in dates

Fix column-only
@texodus
Copy link
Member

texodus commented Feb 27, 2019

Thanks for the PR! This looks great and really improves the JS and C++ API code. I've added a few additional cleanup bits and gone ahead and removed the EMSCRIPTEN_BINDINGS code this PR deprecates - which by itself cuts almost 20k off the WASM asset.

@timkpaine Thanks for the review. Fully agreed on all fronts - we'll definitely need to address these.

@texodus texodus merged commit 711071e into master Feb 27, 2019
@texodus texodus deleted the port-view branch February 27, 2019 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants