Examples of MTable


Examples of com.alibaba.druid.support.monitor.annotation.MTable

        public BeanInfo(Class<?> clazz){
            this.clazz = clazz;

            {
                MTable annotation = clazz.getAnnotation(MTable.class);
                if (annotation == null) {
                    throw new IllegalArgumentException(clazz.getName() + " not contains @MTable");
                }

                tableName = annotation.name();
            }

            for (Field field : clazz.getDeclaredFields()) {
                MField annotation = field.getAnnotation(MField.class);
                if (annotation == null) {
                    continue;
                }

                String columnName = annotation.name();
                if (StringUtils.isEmpty(columnName)) {
                    columnName = field.getName();
                }

                Field hashFor = null;
                String hashForType = null;
                if (!StringUtils.isEmpty(annotation.hashFor())) {
                    try {
                        hashFor = clazz.getDeclaredField(annotation.hashFor());
                        hashForType = annotation.hashForType();
                    } catch (Exception e) {
                        throw new IllegalStateException("hashFor error", e);
                    }
                }

                FieldInfo fieldInfo = new FieldInfo(field, columnName, hashFor, hashForType);
                fields.add(fieldInfo);

                if (annotation.groupBy()) {
                    groupByFields.add(fieldInfo);
                }

                if (hashFor != null) {
                    hashFields.add(fieldInfo);
View Full Code Here

Examples of net.sourceforge.marathon.component.MTable

    }

    @Test
    public void testAssertColumnCount() {
        JTable table = new JTable(1, 3);
        MComponent component = new MTable(table, "table", null, WindowMonitor.getInstance());
        ComponentFinder resolver = new DummyResolver(component);
        ActionTestCase.assertPasses(
                new AssertColumnCount(ID, 3, ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance()), resolver);
        ActionTestCase.assertFails(
                new AssertColumnCount(ID, 4, ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance()), resolver);
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

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

      openTransaction();
      List<MPartition> mparts = listMPartitions(dbName, tblName, maxParts);
      List<Partition> parts = new ArrayList<Partition>(mparts.size());
      if (mparts != null && mparts.size()>0) {
        for (MPartition mpart : mparts) {
          MTable mtbl = mpart.getTable();
          Partition part = convertToPart(mpart);
          parts.add(part);

          if ("TRUE".equalsIgnoreCase(mtbl.getParameters().get("PARTITION_LEVEL_PRIVILEGE"))) {
            String partName = Warehouse.makePartName(this.convertToFieldSchemas(mtbl
                .getPartitionKeys()), part.getValues());
            PrincipalPrivilegeSet partAuth = this.getPartitionPrivilegeSet(dbName,
                tblName, partName, userName, groupNames);
            part.setPrivileges(partAuth);
          }
View Full Code Here

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

        commitTransaction();
        throw new NoSuchObjectException("partition values="
            + partVals.toString());
      }
      Partition part = null;
      MTable mtbl = mpart.getTable();
      part = convertToPart(mpart);
      if ("TRUE".equalsIgnoreCase(mtbl.getParameters().get("PARTITION_LEVEL_PRIVILEGE"))) {
        String partName = Warehouse.makePartName(this.convertToFieldSchemas(mtbl
            .getPartitionKeys()), partVals);
        PrincipalPrivilegeSet partAuth = this.getPartitionPrivilegeSet(dbName,
            tblName, partName, user_name, group_names);
        part.setPrivileges(partAuth);
      }
View Full Code Here

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

      openTransaction();
      LOG.debug("Executing listMPartitionsByFilter");
      dbName = dbName.toLowerCase();
      tableName = tableName.toLowerCase();

      MTable mtable = getMTable(dbName, tableName);
      if( mtable == null ) {
        throw new NoSuchObjectException("Specified database/table does not exist : "
            + dbName + "." + tableName);
      }
      Map<String, String> params = new HashMap<String, String>();
View Full Code Here

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

      openTransaction();
      LOG.debug("Executing listMPartitionsByFilter");
      dbName = dbName.toLowerCase();
      tableName = tableName.toLowerCase();

      MTable mtable = getMTable(dbName, tableName);
      if( mtable == null ) {
        // To be consistent with the behavior of listPartitionNames, if the
        // table or db does not exist, we return an empty list
        return partNames;
      }
View Full Code Here

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

    boolean success = false;
    try {
      openTransaction();
      name = name.toLowerCase();
      dbname = dbname.toLowerCase();
      MTable newt = convertToMTable(newTable);
      if (newt == null) {
        throw new InvalidObjectException("new table is invalid");
      }

      MTable oldt = getMTable(dbname, name);
      if (oldt == null) {
        throw new MetaException("table " + name + " doesn't exist");
      }

      // For now only alter name, owner, paramters, cols, bucketcols are allowed
      oldt.setTableName(newt.getTableName().toLowerCase());
      oldt.setParameters(newt.getParameters());
      oldt.setOwner(newt.getOwner());
      oldt.setSd(newt.getSd());
      oldt.setDatabase(newt.getDatabase());
      oldt.setRetention(newt.getRetention());
      oldt.setPartitionKeys(newt.getPartitionKeys());
      oldt.setTableType(newt.getTableType());
      oldt.setLastAccessTime(newt.getLastAccessTime());

      // commit the changes
      success = commitTransaction();
    } finally {
      if (!success) {
View Full Code Here

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

    if (sd == null) {
      throw new InvalidObjectException("Storage descriptor is not defined for index.");
    }

    MStorageDescriptor msd = this.convertToMStorageDescriptor(sd);
    MTable origTable = getMTable(index.getDbName(), index.getOrigTableName());
    if (origTable == null) {
      throw new InvalidObjectException(
          "Original table does not exist for the given index.");
    }

    MTable indexTable = getMTable(index.getDbName(), index.getIndexTableName());
    if (indexTable == null) {
      throw new InvalidObjectException(
          "Underlying index table does not exist for the given index.");
    }
View Full Code Here

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

    boolean commited = false;
    try {
      openTransaction();
      dbName = dbName.toLowerCase().trim();
      originalTblName = originalTblName.toLowerCase().trim();
      MTable mtbl = getMTable(dbName, originalTblName);
      if (mtbl == null) {
        commited = commitTransaction();
        return null;
      }
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.