No, it's not currently possible to rename columns in Phoenix, but we're discussing that over on PHOENIX-1598 and PHOENIX-1940. The basic idea is that - we'd have one level of indirection for column names by storing the column qualifier name in our Phoenix metadata - we'd generate column qualifier names such that we could look up the KeyValue positionally (HBase does a binary search for this currently which turns out to be expensive) - we'd save space by using shorter column qualifier names
In this case, you get rename for free by just having to change the name in the Phoenix metadata. Currently we don't have this level of indirection - column names correspond directly to column qualifiers. Thus a rename would require re-writing the data. Thanks, James On Tue, Oct 20, 2015 at 10:54 AM, ALEX K <[email protected]> wrote: > > create a new column with the new type (followed by UPSERT SELECT) > > the problem is we can't use the same name as it would throw "duplicate > column name" exception, so will need to copy the values twice (first into > temp column and then to the new column with the original name and new type) > > is it possible to rename columns in Phoenix? > > thanks > Alex > > On Tue, Oct 20, 2015 at 12:41 PM, James Heather < > [email protected]> wrote: > >> This would be of huge benefit to us. >> >> One of the problems we have with MySQL is the locking that's done for >> many schema changes. Any support in Phoenix for online schema changes will >> be a major plus point. >> >> James >> On 20 Oct 2015 5:38 p.m., "James Taylor" <[email protected]> wrote: >> >>> We don't support altering the data type of a column directly. The way >>> I've seen this done is: >>> - create a new column with the new type >>> - copy the old value over, coercing it to the new type (either using >>> UPSERT SELECT or MR) >>> - start using the new column instead of the old column >>> - drop the old column >>> >>> We have a JIRA for it (PHOENIX-152). In theory, we could automate the >>> above process, doing it asynchronously where the data type change wouldn't >>> take effect until the entire process is complete. >>> >>> Thanks, >>> James >>> >>> On Mon, Oct 19, 2015 at 10:29 AM, ALEX K <[email protected]> wrote: >>> >>>> Is it possible to change data type of column in Apache Phoenix without >>>> losing HBase data? >>>> >>> >>> >
