Examples of PreAddPartitionEvent


Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

        ms.openTransaction();
        part.setDbName(dbName);
        part.setTableName(tableName);
        part.setValues(part_vals);

        PreAddPartitionEvent event = new PreAddPartitionEvent(part, this);
        firePreEvent(event);

        MetaStoreUtils.validatePartitionNameCharacters(part_vals, partitionValidationPattern);

        tbl = ms.getTable(part.getDbName(), part.getTableName());
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

        throws InvalidObjectException, AlreadyExistsException, MetaException {
      boolean success = false, madeDir = false;
      Path partLocation = null;
      Table tbl = null;
      try {
        firePreEvent(new PreAddPartitionEvent(part, this));

        MetaStoreUtils.validatePartitionNameCharacters(part.getValues(),
            partitionValidationPattern);

        Partition old_part = null;
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

        if (tbl.getSd().getLocation() == null) {
          throw new MetaException(
              "Cannot append a partition to a view");
        }

        firePreEvent(new PreAddPartitionEvent(tbl, part, this));

        part.setSd(tbl.getSd());
        partLocation = new Path(tbl.getSd().getLocation(), Warehouse
            .makePartName(tbl.getPartitionKeys(), part_vals));
        part.getSd().setLocation(partLocation.toString());
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

          throw new InvalidObjectException("Unable to add partitions because "
              + "database or table " + dbName + "." + tblName + " does not exist");
        }

        if (!parts.isEmpty()) {
          firePreEvent(new PreAddPartitionEvent(tbl, parts, this));
        }

        for (Partition part : parts) {
          if (!part.getTableName().equals(tblName) || !part.getDbName().equals(dbName)) {
            throw new MetaException("Partition does not belong to target table "
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

        if (tbl == null) {
          throw new InvalidObjectException(
              "Unable to add partition because table or database do not exist");
        }

        firePreEvent(new PreAddPartitionEvent(tbl, part, this));

        boolean shouldAdd = startAddPartition(ms, part, false);
        assert shouldAdd; // start would throw if it already existed here
        boolean madeDir = createLocationForAddedPartition(tbl, part);
        try {
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

    AddPartitionEvent partEvent = (AddPartitionEvent)(notifyList.get(listSize-1));
    assert partEvent.getStatus();
    validateAddPartition(part, partEvent.getPartition());
    validateTableInAddPartition(tbl, partEvent.getTable());

    PreAddPartitionEvent prePartEvent = (PreAddPartitionEvent)(preNotifyList.get(listSize-1));
    validateAddPartition(part, prePartEvent.getPartition());

    driver.run(String.format("alter table %s touch partition (%s)", tblName, "b='2011'"));
    listSize++;
    assertEquals(notifyList.size(), listSize);
    assertEquals(preNotifyList.size(), listSize);

    //the partition did not change,
    // so the new partition should be similar to the original partition
    Partition origP = msc.getPartition(dbName, tblName, "b=2011");

    AlterPartitionEvent alterPartEvent = (AlterPartitionEvent)notifyList.get(listSize - 1);
    assert alterPartEvent.getStatus();
    validateAlterPartition(origP, origP, alterPartEvent.getOldPartition().getDbName(),
        alterPartEvent.getOldPartition().getTableName(),
        alterPartEvent.getOldPartition().getValues(), alterPartEvent.getNewPartition());

    PreAlterPartitionEvent preAlterPartEvent =
        (PreAlterPartitionEvent)preNotifyList.get(listSize - 1);
    validateAlterPartition(origP, origP, preAlterPartEvent.getDbName(),
        preAlterPartEvent.getTableName(), preAlterPartEvent.getNewPartition().getValues(),
        preAlterPartEvent.getNewPartition());

    List<String> part_vals = new ArrayList<String>();
    part_vals.add("c=2012");
    Partition newPart = msc.appendPartition(dbName, tblName, part_vals);

    listSize++;
    assertEquals(notifyList.size(), listSize);
    assertEquals(preNotifyList.size(), listSize);

    AddPartitionEvent appendPartEvent =
        (AddPartitionEvent)(notifyList.get(listSize-1));
    validateAddPartition(newPart, appendPartEvent.getPartition());

    PreAddPartitionEvent preAppendPartEvent =
        (PreAddPartitionEvent)(preNotifyList.get(listSize-1));
    validateAddPartition(newPart, preAppendPartEvent.getPartition());

    driver.run(String.format("alter table %s rename to %s", tblName, renamed));
    listSize++;
    assertEquals(notifyList.size(), listSize);
    assertEquals(preNotifyList.size(), listSize);
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

  public void testAddPartitionWithCommas() {

    Partition partition = new Partition();
    partition.setValues(getPartValsWithCommas());

    PreAddPartitionEvent event = new PreAddPartitionEvent(partition, null);

    Assert.assertFalse("Add a partition with commas in name",
                       runHook(event));
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

  public void testAddPartitionWithUnicode() {

    Partition partition = new Partition();
    partition.setValues(getPartValsWithUnicode());

    PreAddPartitionEvent event = new PreAddPartitionEvent(partition, null);

    Assert.assertFalse("Add a partition with unicode characters in name",
                       runHook(event));
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

  public void testAddPartitionWithValidPartVal() {

    Partition p = new Partition();
    p.setValues(getPartValsWithValidCharacters());

    PreAddPartitionEvent event = new PreAddPartitionEvent(p, null);

    Assert.assertTrue("Add a partition with unicode characters in name",
                       runHook(event));
  }
View Full Code Here

Examples of org.apache.hadoop.hive.metastore.events.PreAddPartitionEvent

  public void testAppendPartitionWithUnicode() {

    Partition p = new Partition();
    p.setValues(getPartValsWithUnicode());

    PreAddPartitionEvent event = new PreAddPartitionEvent(p, null);

    Assert.assertFalse("Append a partition with unicode characters in name",
                       runHook(event));
  }
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.