[jira] [Updated] (PHOENIX-1409) Allow ALTER TABLE SET command to update HTableDescriptor and HColumnDescriptor properties

Fri, 09 Jan 2015 13:56:40 -0800

     [ 
https://issues.apache.org/jira/browse/PHOENIX-1409?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Samarth Jain updated PHOENIX-1409:
----------------------------------
    Attachment: PHOENIX-1409-v7.patch

bq How about if you generate a table name like this?

That doesn't solve the problem of slow test class because we still need to drop 
underlying hbase tables. Added comment on the test class AlterTableIT to 
document the reasoning behind the change.

bq Why not keep the existing test unchanged? Just copy/paste the old test and 
give it a new name.

The previous test wasn't really testing anything. 

{code}
@Test
    public void testAlterColumnFamilyProperty() throws Exception {

        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        Connection conn = DriverManager.getConnection(getUrl(), props);
        
        String ddl = "CREATE TABLE test_table " +
                "  (a_string varchar not null, col1 integer" +
                "  CONSTRAINT pk PRIMARY KEY (a_string))\n";
        try {
                conn.createStatement().execute(ddl);
              
                conn.createStatement().execute("ALTER TABLE TEST_TABLE ADD col2 
integer IN_MEMORY=true");
                
                HTableInterface htable1 = 
conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes("TEST_TABLE"));
 
                HTableDescriptor htableDesciptor1 = 
htable1.getTableDescriptor();
                HColumnDescriptor hcolumnDescriptor1 = 
htableDesciptor1.getFamily(QueryConstants.DEFAULT_COLUMN_FAMILY_BYTES);
                assertNotNull(hcolumnDescriptor1);
               
                try {
                    
                    conn.createStatement().execute("ALTER TABLE TEST_TABLE SET 
IN_MEMORY=false");
                    fail("Should have caught exception.");
                    
                } catch (SQLException e) {
                    assertTrue(e.getMessage(), e.getMessage().contains("ERROR 
1025 (42Y84): Unsupported property set in ALTER TABLE command."));
                } 
        }finally {
            conn.close();
        }
     }
{code}
With this change the second part of the test is no longer valid. And the first 
part wasn't really testing anything. So I changed the test to really test what 
it should have in the first place. 

bq  Do we have a test for the case where a property is set which isn't a 
Phoenix property or a HColumnDescriptor property? The behavior at CREATE time 
for this is that it'll end up as an HTableDescriptor property. Can we add a 
test for this and make sure that ALTER TABLE matches this behavior?

Added a test in the patch. See - 
AlterTableIT#testSettingNotHColumnNorPhoenixPropertyEndsUpAsHTableProperty




> Allow ALTER TABLE <table> SET command to update HTableDescriptor and 
> HColumnDescriptor properties
> -------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1409
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1409
>             Project: Phoenix
>          Issue Type: Improvement
>    Affects Versions: 4.2
>            Reporter: James Taylor
>            Assignee: Alicia Ying Shu
>         Attachments: PHOENIX-1409-v3.patch, PHOENIX-1409-v6.patch, 
> PHOENIX-1409-v7.patch, Phoenix-1409-v1.patch, Phoenix-1409-v4-2.patch, 
> Phoenix-1409-v4.patch, Phoenix-1409-v5.patch, Phoenix-1409.patch, WIP.patch, 
> phoenix-1409-v2.patch
>
>
> Once PHOENIX-1408 is fixed, we should allow HTableDescriptor and 
> HColumnDescriptor properties through the ALTER TABLE <table> SET command. 
> It'd just be a matter of passing these properties through the existing 
> methods, as we support this for CREATE TABLE.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to