tajo-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoonson <...@git.apache.org>
Subject [GitHub] tajo pull request: TAJO-1345: Implement logical plan part and DDL ...
Date Thu, 02 Jul 2015 14:18:46 GMT
Github user jihoonson commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/618#discussion_r33782109
  
    --- Diff: tajo-core/src/main/java/org/apache/tajo/master/exec/DDLExecutor.java ---
    @@ -446,11 +447,35 @@ public void alterTable(TajoMaster.MasterContext context, final QueryContext
quer
         case SET_PROPERTY:
           catalog.alterTable(CatalogUtil.setProperty(qualifiedName, alterTable.getProperties(),
AlterTableType.SET_PROPERTY));
           break;
    +    case ADD_PARTITION:
    +      existColumnNames(qualifiedName, alterTable.getColumnNames());
    +      catalog.alterTable(CatalogUtil.addPartitionAndDropPartition(qualifiedName, alterTable.getColumnNames(),
    +        alterTable.getPartitionValues(), alterTable.getLocation(), AlterTableType.ADD_PARTITION));
    +      break;
    +    case DROP_PARTITION:
    +      existColumnNames(qualifiedName, alterTable.getColumnNames());
    +      catalog.alterTable(CatalogUtil.addPartitionAndDropPartition(qualifiedName, alterTable.getColumnNames(),
    +        alterTable.getPartitionValues(), alterTable.getLocation(), AlterTableType.DROP_PARTITION));
    +      break;
         default:
           //TODO
         }
       }
     
    +  private boolean existColumnNames(String tableName, String[] columnNames) {
    +    for(String columnName : columnNames) {
    +      if (!existPartitionColumnName(tableName, columnName)) {
    +        throw new NoSuchColumnException(columnName);
    +      }
    +    }
    +    return true;
    +  }
    +
    +  private boolean existPartitionColumnName(String tableName, String columnName) {
    +    final TableDesc tableDesc = catalog.getTableDesc(tableName);
    +    return tableDesc.getPartitionMethod().getExpressionSchema().contains(columnName)
? true : false;
    --- End diff --
    
    The ```?``` conditional operator seems unnecessary.
    It's also trivial, but makes an Intellij warning.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message