Hi all -
I'm trying to flatten an object graph and have it surface through a TABLE.
For example, I might have a "Person" class:
String name = person.getName();
String phone = person.getPhone();
String add1 = person.getAddress1();
String add2 = person.getAddress2();
Output:
Joe | 333-222-4444 | 8 Rancho Driver
Joe | 333-222-4444 | Sector 22
Joe | 333-222-4444 | Palo Alto, CA
Via SQL, I should be able to issue a SQL query like so:
select NAME, PHONE, ADD1, ADD2, ADD3 from PERSONS
I initially thought of using user-defined functions as tables returning a ResultSet. The problems with this were:
- Cannot implement filtering ("WHERE id=...") at query-time; instad the UDF retrieves the complete result set and THEN filters via WHERE
- I need to implement paging as datasets can be large
- I don't want to wrap this in a UDF as it would require syntax like "select NAME from PERSONS()". I'd rather have "select NAME from PERSONS". If I create a view, it computes the complete dataset first (in this case it would retrieve all 500k persons and THEN provide the view) which I don't want to do.
So, I've decided to use the TableEngine feature (extending TableBase) - however, I'm at a loss as to the implementation details.
My question: To start with, how do I modify the example I've provided (see my pastebin link for code) to allow MULTIPLE rows in a custom table? I want the 5 rows I insert to actually get stored in their entirety. Also, if someone has a more feature-rich example, I'd love to see that as well.
Thanks in advance -
AC