Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial offset design ideas #12015

Closed
wants to merge 54 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
eb37ef5
Initial offset design ideas
AdRiley Jan 7, 2025
7989ce8
Offset Column design work
AdRiley Jan 9, 2025
b0bf1c8
Table design
AdRiley Jan 9, 2025
d8740d2
Start to add test framework
AdRiley Jan 9, 2025
1cd2aa6
Add set_mode
AdRiley Jan 9, 2025
5130f56
Green
AdRiley Jan 10, 2025
bd3768a
More tests
AdRiley Jan 10, 2025
cdffb5d
One more test
AdRiley Jan 10, 2025
b490f0a
Table.offset Red
AdRiley Jan 10, 2025
a74f5fa
Plumbing
AdRiley Jan 10, 2025
ee45c92
More plumbing
AdRiley Jan 10, 2025
da5ec3f
First table test green
AdRiley Jan 10, 2025
089cf05
Next green table test
AdRiley Jan 10, 2025
af95bdc
Next table tests
AdRiley Jan 10, 2025
0d2933f
Green
AdRiley Jan 13, 2025
b331d7d
Red
AdRiley Jan 13, 2025
937f851
Green using mask solution
AdRiley Jan 13, 2025
d01bd24
Refactor
AdRiley Jan 13, 2025
a811df6
refactor
AdRiley Jan 13, 2025
8a97331
Refactor
AdRiley Jan 13, 2025
5d44c4d
More green tests
AdRiley Jan 13, 2025
09664f0
Red
AdRiley Jan 13, 2025
7c41b53
Green
AdRiley Jan 13, 2025
ccfb97c
Refactor
AdRiley Jan 13, 2025
68181ad
Green
AdRiley Jan 13, 2025
1cda931
Red
AdRiley Jan 14, 2025
c1e663a
Green
AdRiley Jan 14, 2025
5b9f789
Green
AdRiley Jan 14, 2025
1119796
Green
AdRiley Jan 14, 2025
c999528
Red
AdRiley Jan 14, 2025
7a2fa9e
Green
AdRiley Jan 14, 2025
4afadeb
Ordering and closet fill
AdRiley Jan 14, 2025
7a60ce6
Green
AdRiley Jan 14, 2025
14ca426
Refactor
AdRiley Jan 14, 2025
b6acd89
Refactor
AdRiley Jan 14, 2025
74d80a8
Refactor
AdRiley Jan 14, 2025
64dde8a
Cleanup
AdRiley Jan 14, 2025
6de5c51
Refactor
AdRiley Jan 15, 2025
9309586
Documentaion
AdRiley Jan 15, 2025
c50fef4
Column Names
AdRiley Jan 15, 2025
f928e1e
Multiple columns
AdRiley Jan 16, 2025
1b37fa6
Refactor
AdRiley Jan 16, 2025
134b818
Refactor
AdRiley Jan 16, 2025
67f9137
Refactor
AdRiley Jan 16, 2025
b9c69e2
Refactor
AdRiley Jan 16, 2025
791740a
Refactor
AdRiley Jan 16, 2025
8df3f4c
set_mode=update
AdRiley Jan 16, 2025
1dd496d
More tests
AdRiley Jan 17, 2025
88a8063
Remove on_problems
AdRiley Jan 17, 2025
b572fde
Rename to Fill_With
AdRiley Jan 17, 2025
6a37f2d
Documentation
AdRiley Jan 17, 2025
1eeff6f
Revert "Remove on_problems"
AdRiley Jan 17, 2025
3d5c77d
fmt
AdRiley Jan 17, 2025
7819762
New alias
AdRiley Jan 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More plumbing
  • Loading branch information
AdRiley committed Jan 17, 2025
commit ee45c9287e3ae4e5eb6514a8aab44e9f29465c83
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,71 @@
import org.enso.table.data.table.Column;
import org.enso.table.problems.ProblemAggregator;

import java.util.BitSet;

import org.enso.table.data.column.storage.numeric.DoubleStorage;
import org.enso.table.problems.ColumnAggregatedProblemAggregator;

public class Offset {
public static Storage<?> offset(
Column sourceColumn,
Column[] groupingColumns,
Column[] orderingColumns,
int[] directions,
ProblemAggregator problemAggregator) {
return sourceColumn.getStorage();
var offsetRunningStatistic = new OffsetRunningStatistic<Double>(sourceColumn, problemAggregator);
RunningLooper.loop(
groupingColumns,
orderingColumns,
directions,
problemAggregator,
offsetRunningStatistic,
sourceColumn.getSize());
return offsetRunningStatistic.getResult();
}

private static class OffsetRunningStatistic<T> implements RunningStatistic<Double> {

long[] result;
BitSet isNothing;
ColumnAggregatedProblemAggregator columnAggregatedProblemAggregator;
Column sourceColumn;

OffsetRunningStatistic(Column sourceColumn, ProblemAggregator problemAggregator) {
result = new long[sourceColumn.getSize()];
isNothing = new BitSet();
columnAggregatedProblemAggregator = new ColumnAggregatedProblemAggregator(problemAggregator);
this.sourceColumn = sourceColumn;
}

@Override
public void calculateNextValue(int i, RunningIterator<Double> it) {

}

@Override
public Storage<Double> getResult() {
return new DoubleStorage(result, sourceColumn.getSize(), isNothing);
}

@Override
public RunningIterator<Double> getNewIterator() {
return new OffsetRunning();
}
}


private static class OffsetRunning implements RunningIterator<Double> {

@Override
public Double next(Double value) {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Double currentValue() {
throw new UnsupportedOperationException("Not supported yet.");
}

}
}