private void updatePartitionDesc(CubeDesc oldModel, DataModelDesc dm) { CubePartitionDesc partition = oldModel.getCubePartitionDesc(); PartitionDesc newPartition = new PartitionDesc(); if (partition.getPartitionDateColumn() != null) { String partitionCol = partition.getPartitionDateColumn(); String[] tablecolumn = partitionCol.split("\\."); if (tablecolumn != null && tablecolumn.length == 2) { // pattern is <tablename>.<colname> String tableFullName = getMetadataManager().appendDBName(tablecolumn[0]); newPartition.setPartitionDateColumn(tableFullName + "." + tablecolumn[1]); } else { if (partitionCol.indexOf(".") < 0) { // pattern is <colname> partitionCol = dm.getFactTable() + "." + partitionCol; } newPartition.setPartitionDateColumn(partitionCol); } } // only append is supported newPartition.setCubePartitionType(PartitionDesc.PartitionType.APPEND); newPartition.setPartitionDateStart(partition.getPartitionDateStart()); dm.setPartitionDesc(newPartition); }
public static PartitionDesc getCopyOf(PartitionDesc partitionDesc) { PartitionDesc newPartDesc = new PartitionDesc(); newPartDesc.setCubePartitionType(partitionDesc.getCubePartitionType()); newPartDesc.setPartitionDateColumn(partitionDesc.getPartitionDateColumn()); newPartDesc.setPartitionDateFormat(partitionDesc.getPartitionDateFormat()); newPartDesc.setPartitionDateStart(partitionDesc.getPartitionDateStart()); return newPartDesc; } }
private void updatePartitionDesc(CubeDesc oldModel, DataModelDesc dm) { CubePartitionDesc partition = oldModel.getCubePartitionDesc(); PartitionDesc newPartition = new PartitionDesc(); if (partition.getPartitionDateColumn() != null) { String partitionCol = partition.getPartitionDateColumn(); String[] tablecolumn = partitionCol.split("\\."); if (tablecolumn != null && tablecolumn.length == 2) { // pattern is <tablename>.<colname> String tableFullName = getMetadataManager().appendDBName(tablecolumn[0]); newPartition.setPartitionDateColumn(tableFullName + "." + tablecolumn[1]); } else { if (partitionCol.indexOf(".") < 0) { // pattern is <colname> partitionCol = dm.getFactTable() + "." + partitionCol; } newPartition.setPartitionDateColumn(partitionCol); } } // only append is supported newPartition.setCubePartitionType(PartitionDesc.PartitionType.APPEND); newPartition.setPartitionDateStart(partition.getPartitionDateStart()); dm.setPartitionDesc(newPartition); }