public String getMethodDescription() { if (methodType != PARTITIONING_METHOD_SPECIAL) { return methodDescriptions[methodType]; } else { return partitioner.getDescription(); } }
public StepPartitioningMeta clone() { StepPartitioningMeta stepPartitioningMeta = new StepPartitioningMeta( method, partitionSchema != null ? (PartitionSchema) partitionSchema.clone() : null); stepPartitioningMeta.partitionSchemaName = partitionSchemaName; stepPartitioningMeta.setMethodType(methodType); stepPartitioningMeta.setPartitioner(partitioner == null ? null : partitioner.clone()); return stepPartitioningMeta; }
public StepPartitioningMeta(Repository rep, long id_step) throws KettleException { this(); partitionSchemaName = rep.getStepAttributeString(id_step, "PARTITIONING_SCHEMA"); String methodCode = rep.getStepAttributeString(id_step, "PARTITIONING_METHOD"); setMethod(getMethod(methodCode)); if (partitioner != null) { partitioner.loadRep(rep, id_step); } hasChanged = true; }
public String getMethodCode() { if (methodType == PARTITIONING_METHOD_SPECIAL) { if (partitioner != null) { return partitioner.getId(); } else { return methodCodes[PARTITIONING_METHOD_NONE]; } } return methodCodes[methodType]; }
public StepPartitioningMeta(Node partitioningMethodNode) throws KettleXMLException { this(); setMethod(getMethod(XMLHandler.getTagValue(partitioningMethodNode, "method"))); partitionSchemaName = XMLHandler.getTagValue(partitioningMethodNode, "schema_name"); hasChanged = false; if (partitioner != null) { partitioner.loadXML(partitioningMethodNode); } if (methodType != PARTITIONING_METHOD_NONE && Const.isEmpty(partitionSchemaName)) { throw new RuntimeException("bohoo!"); } }
@Override public String toString() { String description; if (partitioner != null) { description = partitioner.getDescription(); } else { description = getMethodDescription(); } if (partitionSchema != null) { description += " / " + partitionSchema.toString(); } return description; }
public void createPartitioner(String method) { methodType = getMethodType(method); switch (methodType) { case PARTITIONING_METHOD_SPECIAL: { partitioner = StepLoader.getPartitioner(method).getInstance(); break; } case PARTITIONING_METHOD_NONE: default: partitioner = null; } if (partitioner != null) { partitioner.setMeta(this); } }
public String getXML() { StringBuffer xml = new StringBuffer(150); xml.append(" <partitioning>").append(Const.CR); xml.append(" ").append(XMLHandler.addTagValue("method", getMethodCode())); xml.append(" ") .append( XMLHandler.addTagValue( "schema_name", partitionSchema != null ? partitionSchema.getName() : "")); if (partitioner != null) { xml.append(partitioner.getXML()); } xml.append(" </partitioning>").append(Const.CR); return xml.toString(); }
public int getPartition(RowMetaInterface rowMeta, Object[] row) throws KettleException { if (partitioner != null) { return partitioner.getPartition(rowMeta, row); } return 0; }