airbnb / airpal

Web UI for PrestoDB.
http://airbnb.github.io/airpal
Apache License 2.0
2.76k stars 459 forks source link

feature request: realtime sort & filtering on data preview without requerying #89

Open donpinkus opened 9 years ago

donpinkus commented 9 years ago

First off, AirPal looks awesome, way to kill it :)

So some useful additions on the data preview:

use-case: It's pretty common that you start with 1 particular value of interest. Maybe a client name, charge amount & date, etc. I remember during meetings or via e-mail getting asked to pull something from the db, which was really just a specific row. Add filtering & sorting to a table, then it lets any person familiar with Excel to get this kind of data out of AirPal.

implementation: From FixedDataTable docs I don't believe they do virtualization... maybe I'm wrong. You can do this without requerying the table or crashing the DOM if you use SlickGrid (https://github.com/mleibman/SlickGrid). It just does virtual rendering for your table so you can have ~ 1M rows without destroying the DOM / js. Then the filtering or sorting is instant (<100ms from when I used it on ~1M rows).

I'm sure you'll still have partitions that need to be capped at 1M (maybe I'm forgetting the scale of most hive partitions), but for a lot of tables it's pretty useful when exploring the data or trying to check values quickly. For example, we can sort by date & by transaction size. Or find a row with a particular location & rating - all without writing SQL / waiting for requery.

One downside to SlickGrid, is it doesn't use HTMLs table algorithm to size columns (since the rows aren't actually part of the DOM). But you can take the max() of each column and render it offscreen to get the ~column widths.

quard8 commented 9 years ago

From FixedDataTable docs I don't believe they do virtualization...

Actually, they do.

mistercrunch commented 9 years ago

I'm not very familiar with SlickGrid (looks good at first sight) but wanted to chime in that I've happily used datatables (http://www.datatables.net/) for a few projects.

Add it to the list of libs to evaluate for this feature!