No, actually, my point was that (in spite of steps in the right direction)
this code works (only) for any table with a single numeric primary key
named "pkey" -- otherwise gets a ProcCallException for "select max(pkey)
..." which I assume could be fixed by actually using pkeyColIndex (with
some TableHelper magic?) to get the key name.


On Wed, Feb 20, 2013 at 1:52 PM, John Hugg <notifications@github.com> wrote:

> In src/frontend/org/voltdb/TableHelper.java:
>
> > +     * Delete rows in a VoltDB table that has a bigint pkey where pkey values are odd.
> > +     * Works best when pkey values are contiguous and start around 0.
> > +     *
> > +     * Exists mostly to force compaction on tables loaded with fillTableWithBigintPkey.
> > +     * Though if you have an even number of sites, this won't work. It'll need to be
> > +     * updated to delete some other pattern that's a bit more generic. Right now it
> > +     * works great for my one-site testing.
> > +     *
> > +     */
> > +    public static void deleteOddRows(VoltTable t, Client client) throws Exception {
> > +        // find the primary key, assume first col if not found
> > +        int pkeyColIndex = getBigintPrimaryKeyIndexIfExists(t);
> > +        if (pkeyColIndex == -1) {
> > +            pkeyColIndex = 0;
> > +            assert(t.getColumnType(0) == VoltType.BIGINT);
> > +        }
>
> This code works for any table with an single integer pkey. I'm not
> assuming I've used the random-table generation code. I will change the
> assertion to accept all integer types.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/VoltDB/voltdb/pull/386/files#r3085934>.
>
>