Skip to content

Commit

Permalink
making inheritance more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
vikasgupta78 committed Apr 14, 2024
1 parent 5c5e845 commit d344cf1
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
Expand Up @@ -11,7 +11,7 @@
import zingg.common.core.block.Tree;
import zingg.common.core.util.BlockingTreeUtil;

public class BlockedFrame<S, D, R, C, T> implements IZFrameProcessor<S, D, R, C, T> {
public class BlockedFrame<S, D, R, C, T> implements IZFrameProcessor<D, R, C> {

protected ZFrame<D,R,C> originalDF;

Expand Down
Expand Up @@ -7,15 +7,16 @@

import zingg.common.client.FieldDefinition;
import zingg.common.client.ZFrame;
import zingg.common.client.cols.SelectedCols;
import zingg.common.client.cols.ZidAndFieldDefSelector;

public class FieldDefFrame<S, D, R, C, T> implements IZFrameProcessor<S, D, R, C, T> {
public class FieldDefFrame<D, R, C> implements IZFrameProcessor<D, R, C> {

protected ZFrame<D,R,C> originalDF;

protected ZFrame<D,R,C> processedDF;

protected ZidAndFieldDefSelector zidAndFieldDefSelector;
protected SelectedCols selectedCols;

protected List<? extends FieldDefinition> fieldDefinition;

Expand All @@ -26,10 +27,10 @@ public FieldDefFrame(ZFrame<D, R, C> originalDF, List<? extends FieldDefinition>
}

public FieldDefFrame(ZFrame<D, R, C> originalDF, List<? extends FieldDefinition> fieldDefinition,
ZidAndFieldDefSelector zidAndFieldDefSelector) {
SelectedCols selectedCols) {
this.originalDF = originalDF;
this.fieldDefinition = fieldDefinition;
this.zidAndFieldDefSelector = zidAndFieldDefSelector;
this.selectedCols = selectedCols;
}

@Override
Expand All @@ -44,7 +45,7 @@ public ZFrame<D, R, C> getProcessedDF() {

@Override
public void process() {
this.processedDF = getOriginalDF().select(zidAndFieldDefSelector.getCols());
this.processedDF = getOriginalDF().select(selectedCols.getCols());
// return getDSUtil().getFieldDefColumnsDS(testDataOriginal, args, true);
}

Expand Down
Expand Up @@ -3,7 +3,7 @@
import zingg.common.client.ZFrame;
import zingg.common.client.ZinggClientException;

public interface IZFrameProcessor<S, D, R, C, T> {
public interface IZFrameProcessor<D, R, C> {

public ZFrame<D,R,C> getOriginalDF();

Expand Down
Expand Up @@ -9,7 +9,7 @@
import zingg.common.client.ZinggClientException;
import zingg.common.core.preprocess.IPreProcessor;

public class PreprocessedFrame<S, D, R, C, T> implements IZFrameProcessor<S, D, R, C, T> {
public class PreprocessedFrame<S, D, R, C, T> implements IZFrameProcessor<D, R, C> {

protected ZFrame<D,R,C> originalDF;

Expand Down
Expand Up @@ -6,7 +6,7 @@
import zingg.common.client.IArguments;
import zingg.common.client.ZFrame;

public class RepartitionFrame<S, D, R, C, T> implements IZFrameProcessor<S, D, R, C, T> {
public class RepartitionFrame<D, R, C> implements IZFrameProcessor<D, R, C> {

protected ZFrame<D,R,C> originalDF;

Expand Down
17 changes: 11 additions & 6 deletions common/core/src/main/java/zingg/common/core/data/df/ZData.java
Expand Up @@ -8,6 +8,7 @@
import zingg.common.client.IArguments;
import zingg.common.client.ZFrame;
import zingg.common.client.ZinggClientException;
import zingg.common.client.cols.ZidAndFieldDefSelector;
import zingg.common.client.util.ColName;
import zingg.common.core.context.Context;
import zingg.common.core.preprocess.IPreProcessor;
Expand All @@ -19,10 +20,10 @@ public class ZData<S, D, R, C, T> {
protected Context<S,D,R,C,T> context;
protected List<IPreProcessor<S,D,R,C,T>> preProcessors;

protected FieldDefFrame<S, D, R, C, T> fieldDefFrame;
protected FieldDefFrame<D, R, C> fieldDefFrame;
protected BlockedFrame<S, D, R, C, T> blockedFrame;
protected PreprocessedFrame<S, D, R, C, T> preprocessedFrame;
protected RepartitionFrame<S, D, R, C, T> repartitionFrame;
protected RepartitionFrame<D, R, C> repartitionFrame;

public static final Log LOG = LogFactory.getLog(ZData.class);

Expand All @@ -37,15 +38,15 @@ public ZFrame<D, R, C> getRawData() {
return rawData;
}

public FieldDefFrame<S, D, R, C, T> getFieldDefFrame() {
public FieldDefFrame<D, R, C> getFieldDefFrame() {
return fieldDefFrame;
}

public PreprocessedFrame<S, D, R, C, T> getPreprocessedFrame() {
return preprocessedFrame;
}

public RepartitionFrame<S, D, R, C, T> getRepartitionFrame() {
public RepartitionFrame<D, R, C> getRepartitionFrame() {
return repartitionFrame;
}

Expand All @@ -67,17 +68,21 @@ public void process() throws ZinggClientException {
}

protected void setFieldDefFrame() {
this.fieldDefFrame = new FieldDefFrame<S, D, R, C, T>(getRawData(),args.getFieldDefinition());
this.fieldDefFrame = new FieldDefFrame<D, R, C>(getRawData(),args.getFieldDefinition(),getColSelector());
this.fieldDefFrame.process();
}

protected ZidAndFieldDefSelector getColSelector() {
return new ZidAndFieldDefSelector(args.getFieldDefinition());
}

protected void setPreprocessedFrame() throws ZinggClientException {
this.preprocessedFrame = new PreprocessedFrame<S, D, R, C, T>(getFieldDefFrame().getProcessedDF(),preProcessors);
this.preprocessedFrame.process();
}

protected void setRepartitionFrame() {
this.repartitionFrame = new RepartitionFrame<S, D, R, C, T>(getPreprocessedFrame().getProcessedDF(),args.getNumPartitions(),ColName.ID_COL);
this.repartitionFrame = new RepartitionFrame<D, R, C>(getPreprocessedFrame().getProcessedDF(),args.getNumPartitions(),ColName.ID_COL);
this.repartitionFrame.process();
}

Expand Down

0 comments on commit d344cf1

Please sign in to comment.