[ 
https://issues.apache.org/jira/browse/PHOENIX-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16795211#comment-16795211
 ] 

Geoffrey Jacoby commented on PHOENIX-1614:
------------------------------------------

One small test improvement: in AppendOnlySchemaIT, I see there's the following 
check:

{code:java}
           // if not verify exists is true one call to add column table with 
empty mutation list
           // (which does not make a rpc) else verify no add column calls
            verify(connectionQueryServices, notExists ? times(1) : never())
              .addColumn(eq(Collections.emptyList()), any(PTable.class), 
anyMap(),
                anySetOf(String.class), anyListOf(PColumn.class), anyBoolean());
{code}

Rather than anyBoolean(), shouldn't it be asserting that notExists is passed to 
addColumn?

Other than that, this looks good. It appears that because the new protobuf 
field is optional this will be backward compatible -- older clients will not 
get the benefits of the bug fix, but will still work. If this isn't the case 
because I'm missing something, please let me know, because we should be sure of 
that before committing.

> ALTER TABLE ADD IF NOT EXISTS doesn't work as expected
> ------------------------------------------------------
>
>                 Key: PHOENIX-1614
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1614
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Gabriel Reid
>            Assignee: Toshihiro Suzuki
>            Priority: Major
>              Labels: argus
>             Fix For: 4.15.0
>
>         Attachments: PHOENIX-1614-v2.patch, PHOENIX-1614-v3.patch, 
> PHOENIX-1614.patch
>
>
> On an existing table table, executing "ALTER TABLE ADD IF NOT EXISTS
> thisColAlreadyExists varchar, thisColDoesNotExist varchar", then
> nothing will be changed in the table because thisColAlreadyExists
> already exists.
> Omitting the already-existing column from the statement, all new columns
> do get created.
> The general expectation would be that when you use ADD IF NOT EXISTS, all
> non-existent columns will be added, and all existing columns in the
> statement will just be ignored. There is already an integration test
> (AlterTableIT#testAddVarCols) that actually demonstrates the current
> behavior, although this is probably not correct.
> As pointed out in the related mailing list thread [1], ALTER TABLE DROP 
> COLUMN likely suffers from the same issue.
> 1. http://s.apache.org/LMT 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to