You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WindowedOperator initializes maxWindowTime to 0, so if we use real timestamps or something else starting not from 0 in time column, then we will get a lot of empty panes until it reaches these values.
Is it intended to work like that?
I think it can be easily fixed/improved by adding setter for this value allowing the client to initialize it to any needed value,
For example like this
--- a/lib/src/main/java/edu/stanford/futuredata/macrobase/operator/WindowedOperator.java+++ b/lib/src/main/java/edu/stanford/futuredata/macrobase/operator/WindowedOperator.java@@ -19,7 +19,7 @@ public class WindowedOperator<O>
private double windowLength = 60.0;
private double slideLength = 10.0;
- private double maxWindowTime;+ private double maxWindowTime = Double.MAX_VALUE;
private IncrementalOperator<O> op;
private ArrayList<DataFrame> batchBuffer;
@@ -28,7 +28,9 @@ public class WindowedOperator<O>
this.op = op;
}
public WindowedOperator<O> initialize() {
- this.maxWindowTime = 0.0;+ if (maxWindowTime == Double.MAX_VALUE) {+ this.maxWindowTime = 0.0;+ }
this.batchBuffer = new ArrayList<>();
int numPanes = (int)Math.ceil(windowLength / slideLength);
@@ -134,6 +136,10 @@ public class WindowedOperator<O>
return maxWindowTime;
}
+ public void setMaxWindowTime(double maxWindowTime) {+ this.maxWindowTime = maxWindowTime;+ }+
public int getBufferSize() {
return batchBuffer.size();
}
By the way, what's the reason for adding initialize method instead of doing it in the constructor?
UPD: ah, I guess it's because windowSize has to be set via setter from the interface. But maxWindowTime probably can be initialized during construction.
--- a/lib/src/main/java/edu/stanford/futuredata/macrobase/operator/WindowedOperator.java+++ b/lib/src/main/java/edu/stanford/futuredata/macrobase/operator/WindowedOperator.java@@ -19,7 +19,7 @@ public class WindowedOperator<O>
private double windowLength = 60.0;
private double slideLength = 10.0;
- private double maxWindowTime;+ private double maxWindowTime = 0.0;
private IncrementalOperator<O> op;
private ArrayList<DataFrame> batchBuffer;
@@ -28,7 +28,6 @@ public class WindowedOperator<O>
this.op = op;
}
public WindowedOperator<O> initialize() {
- this.maxWindowTime = 0.0;
this.batchBuffer = new ArrayList<>();
int numPanes = (int)Math.ceil(windowLength / slideLength);
@@ -134,6 +133,10 @@ public class WindowedOperator<O>
return maxWindowTime;
}
+ public void setMaxWindowTime(double maxWindowTime) {+ this.maxWindowTime = maxWindowTime;+ }+
public int getBufferSize() {
return batchBuffer.size();
}
The text was updated successfully, but these errors were encountered:
WindowedOperator
initializesmaxWindowTime
to 0, so if we use real timestamps or something else starting not from 0 intime
column, then we will get a lot of empty panes until it reaches these values.Is it intended to work like that?
I think it can be easily fixed/improved by adding setter for this value allowing the client to initialize it to any needed value,
For example like this
By the way, what's the reason for adding
initialize
method instead of doing it in the constructor?UPD: ah, I guess it's because
windowSize
has to be set via setter from the interface. ButmaxWindowTime
probably can be initialized during construction.The text was updated successfully, but these errors were encountered: