I'm in the process of re-writing the HQL parser using the latest version of
Boost Spirit.  As part of this process, I'd like to clean up HQL.  I
propose that we drop the DELETE command in favor of a more flexible INSERT
command.  The basic format of the INSERT command will remain the same:

INSERT INTO <table> VALUES '(' <value-tuple> ')' [ '(' <value-tuple> ')'
... ]

But the format of <value-tuple> would change to be more flexible, allowing
for *deletes* as well as *inserts*.

*Timestamps* - As is the case now, timestamps will be optional in the
<value-tuple>.  However, I propose moving the timestamp to the end and
not requiring quotes around the timestamp.  Here are examples of the
supported formats for the <timestamp> field:

auto                           # auto-assign timestamp
min                            # absolute minimum timestamp
2012                           # date (year-only)
2012-08                        # date (year+month)
2012-08-08                     # date
2012-08-08 12:02:00            # date+time
2012-08-08 12:02:00:823432455  # date+time with nanoseconds
1234343454s                    # seconds since the epoch
1234343454782639847ns          # nanoseconds since the epoch

*Inserts* - The following are <value-tuple> examples for inserts:

("row", "c:q", "value")
("row", "c:q", "value", <timestamp>)
(INS, "row", "c:q", "value")
(INS, "row", "c:q", "value", <timestamp>)

*Delete Row* - The following are <value-tuple> examples for deleting rows:

(DEL, "row")
(DEL, "row", <timestamp>)

*Delete Column Family* - The following are <value-tuple> examples for
deleting column families:

(DEL, "row", "c")
(DEL, "row", "c", <timestamp>)

*Delete Cell* - The following are <value-tuple> examples for deleting cells
(e.g. delete all cell versions with this timestamp or less):

(DEL, "row", "c:q")
(DEL, "row", "c:q", <timestamp>)

*Delete Cell Version* - The following are <value-tuple> examples for
deleting a specific cell version (e.g. delete the cell version with this
exact timestamp):

(DEL_VER, "row", "c:q")
(DEL_VER, "row", "c:q", <timestamp>)

The INSERT command will accept a mix of any of the above <value-tuple>
formats, which will obviate the need for the DELETE command (which was kind
of wacky anyway).  Here are a couple of DELETE examples along with how they
would be formulated with the new INSERT syntax:

DELETE c FROM foo WHERE ROW = "row1;
INSERT INTO foo VALUES (DEL, "row1", "c");

DELETE * FROM foo WHERE ROW = "row1 TIMESTAMP "2012-02-13";
INSERT INTO foo VALUES (DEL, "row1", 2012-02-13);

If you have any feedback, please let me know.  I'd like make these changes
for the upcoming 0.9.6.1 release.

- Doug

-- 
You received this message because you are subscribed to the Google Groups 
"Hypertable Development" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hypertable-dev?hl=en.

Reply via email to