Examples of MTable


Examples of org.apache.hadoop.hive.metastore.model.MTable

                    .toString(), dbObj, privilege, now, grantor, grantorType, grantOption);
                persistentObjs.add(mDb);
              }
            }
          } else if (hiveObject.getObjectType() == HiveObjectType.TABLE) {
            MTable tblObj = getMTable(hiveObject.getDbName(), hiveObject
                .getObjectName());
            if (tblObj != null) {
              List<MTablePrivilege> tablePrivs = this
                  .listAllTableGrants(userName, principalType,
                      hiveObject.getDbName(), hiveObject.getObjectName());
              if (tablePrivs != null) {
                for (MTablePrivilege priv : tablePrivs) {
                  if (priv.getGrantor() != null
                      && priv.getGrantor().equalsIgnoreCase(grantor)) {
                    privSet.add(priv.getPrivilege());
                  }
                }
              }
              for (String privilege : privs) {
                if (privSet.contains(privilege)) {
                  throw new InvalidObjectException(privilege
                      + " is already granted on table ["
                      + hiveObject.getDbName() + ","
                      + hiveObject.getObjectName() + "] by " + grantor);
                }
                MTablePrivilege mTab = new MTablePrivilege(
                    userName, principalType.toString(), tblObj,
                    privilege, now, grantor, grantorType, grantOption);
                persistentObjs.add(mTab);
              }
            }
          } else if (hiveObject.getObjectType() == HiveObjectType.PARTITION) {
            MPartition partObj = this.getMPartition(hiveObject.getDbName(),
                hiveObject.getObjectName(), hiveObject.getPartValues());
            String partName = null;
            if (partObj != null) {
              partName = partObj.getPartitionName();
              List<MPartitionPrivilege> partPrivs = this
                  .listPrincipalPartitionGrants(userName,
                      principalType, hiveObject.getDbName(), hiveObject
                          .getObjectName(), partObj.getPartitionName());
              if (partPrivs != null) {
                for (MPartitionPrivilege priv : partPrivs) {
                  if (priv.getGrantor().equalsIgnoreCase(grantor)) {
                    privSet.add(priv.getPrivilege());
                  }
                }
              }
              for (String privilege : privs) {
                if (privSet.contains(privilege)) {
                  throw new InvalidObjectException(privilege
                      + " is already granted on partition ["
                      + hiveObject.getDbName() + ","
                      + hiveObject.getObjectName() + ","
                      + partName + "] by " + grantor);
                }
                MPartitionPrivilege mTab = new MPartitionPrivilege(userName,
                    principalType.toString(), partObj, privilege, now, grantor,
                    grantorType, grantOption);
                persistentObjs.add(mTab);
              }
            }
          } else if (hiveObject.getObjectType() == HiveObjectType.COLUMN) {
            MTable tblObj = getMTable(hiveObject.getDbName(), hiveObject
                .getObjectName());
            if (tblObj != null) {
              if (hiveObject.getPartValues() != null) {
                MPartition partObj = null;
                List<MPartitionColumnPrivilege> colPrivs = null;
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

       throw new InvalidObjectException("Invalid column stats object");
     }

     String dbName = statsDesc.getDbName();
     String tableName = statsDesc.getTableName();
     MTable table = getMTable(dbName, tableName);

     if (table == null) {
       throw new NoSuchObjectException("Table " + tableName +
       " for which stats is gathered doesn't exist.");
     }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

     String colName = mStatsObj.getColName();

     LOG.info("Updating table level column statistics for db=" + dbName + " tableName=" + tableName
       + " colName=" + colName);

     MTable mTable = getMTable(mStatsObj.getDbName(), mStatsObj.getTableName());
     boolean foundCol = false;

     if (mTable == null) {
        throw new
          NoSuchObjectException("Table " + tableName +
          " for which stats gathering is requested doesn't exist.");
      }

      MStorageDescriptor mSDS = mTable.getSd();
      List<MFieldSchema> colList = mSDS.getCD().getCols();

      for(MFieldSchema mCol:colList) {
        if (mCol.getName().equals(mStatsObj.getColName().trim())) {
          foundCol = true;
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

    String colName = mStatsObj.getColName();

    LOG.info("Updating partition level column statistics for db=" + dbName + " tableName=" +
      tableName + " partName=" + partName + " colName=" + colName);

    MTable mTable = getMTable(mStatsObj.getDbName(), mStatsObj.getTableName());
    boolean foundCol = false;

    if (mTable == null) {
      throw new
        NoSuchObjectException("Table " + tableName +
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

    }

    try {
      openTransaction();
      MTableColumnStatistics mStatsObj = null;
      MTable mTable = getMTable(dbName.trim(), tableName.trim());
      boolean foundCol = false;

      if (mTable == null) {
        throw new NoSuchObjectException("Table " + tableName +
        " for which stats is requested doesn't exist.");
      }

      MStorageDescriptor mSDS = mTable.getSd();
      List<MFieldSchema> colList = mSDS.getCD().getCols();

      for(MFieldSchema mCol:colList) {
        if (mCol.getName().equals(colName.trim())) {
          foundCol = true;
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

        " get_partition_column_statistics is null");
    }

    try {
      openTransaction();
      MTable mTable = getMTable(dbName.trim(), tableName.trim());
      boolean foundCol = false;

      if (mTable == null) {
        throw new NoSuchObjectException("Table "  + tableName +
          " for which stats is requested doesn't exist.");
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

      throw new InvalidInputException("Table name is null.");
    }

    try {
      openTransaction();
      MTable mTable = getMTable(dbName, tableName);
      MPartitionColumnStatistics mStatsObj;
      List<MPartitionColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

      throw new InvalidInputException("Table name is null.");
    }

    try {
      openTransaction();
      MTable mTable = getMTable(dbName, tableName);
      MTableColumnStatistics mStatsObj;
        List<MTableColumnStatistics> mStatsObjColl;

      if (mTable == null) {
        throw new
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

    boolean commited = false;
    try {
      openTransaction();
      dbName = dbName.toLowerCase().trim();
      tableName = tableName.toLowerCase().trim();
      MTable mtbl = getMTable(dbName, tableName);
      if (mtbl == null) {
        commited = commitTransaction();
        return null;
      }
      // Change the query to use part_vals instead of the name which is
      // redundant
      String name = Warehouse.makePartName(convertToFieldSchemas(mtbl
          .getPartitionKeys()), part_vals);
      Query query = pm.newQuery(MPartition.class,
          "table.tableName == t1 && table.database.name == t2 && partitionName == t3");
      query.declareParameters("java.lang.String t1, java.lang.String t2, java.lang.String t3");
      query.setUnique(true);
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.model.MTable

  private MPartition convertToMPart(Partition part)
      throws InvalidObjectException, MetaException {
    if (part == null) {
      return null;
    }
    MTable mt = getMTable(part.getDbName(), part.getTableName());
    if (mt == null) {
      throw new InvalidObjectException(
          "Partition doesn't have a valid table or database name");
    }
    return new MPartition(Warehouse.makePartName(convertToFieldSchemas(mt
        .getPartitionKeys()), part.getValues()), mt, part.getValues(), part
        .getCreateTime(), part.getLastAccessTime(),
        convertToMStorageDescriptor(part.getSd()), part.getParameters());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.