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

feat: add multi-column support to UpdateBy RollingFormula() operator #6143

Merged
merged 17 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final byte e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public byte[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -122,9 +123,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -155,6 +156,7 @@ public boolean add(final char e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
lbooker42 marked this conversation as resolved.
Show resolved Hide resolved
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -389,4 +391,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public char[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final double e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public double[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final float e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public float[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final int e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public int[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final long e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public long[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -128,10 +129,17 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
Arrays.fill(storage, null);
final int storageHead = (int) (head & mask);
final int size = size();
// firstLen is either the size of the ring buffer oe the distance from head to the end of the storage array.
lbooker42 marked this conversation as resolved.
Show resolved Hide resolved
final int firstLen = Math.min(storage.length - storageHead, size);
// secondLen is the number of elements remaining from the first clear.
final int secondLen = size - firstLen;
Arrays.fill(storage, storageHead, storageHead + firstLen, null);
Arrays.fill(storage, 0, secondLen, null);
// endregion object-bulk-clear
tail = head = 0;
lbooker42 marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -162,6 +170,7 @@ public boolean add(final T e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -411,4 +420,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public T[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import io.deephaven.base.MathUtil;
import io.deephaven.base.verify.Assert;
import org.jetbrains.annotations.TestOnly;

import java.io.Serializable;
import java.util.NoSuchElementException;
Expand Down Expand Up @@ -126,9 +127,9 @@ public int remaining() {

@Override
public void clear() {
tail = head = 0;
// region object-bulk-clear
// endregion object-bulk-clear
tail = head = 0;
}

/**
Expand Down Expand Up @@ -159,6 +160,7 @@ public boolean add(final short e) {
* @param count the minimum number of empty entries in the buffer after this call
* @throws UnsupportedOperationException when {@code growable} is {@code false} and buffer is full
*/
@Override
public void ensureRemaining(final int count) {
if (remaining() < count) {
if (!growable) {
Expand Down Expand Up @@ -393,4 +395,14 @@ public void remove() {
throw new UnsupportedOperationException();
}
}

/**
* Get the storage array for this ring buffer. This is intended for testing and debugging purposes only.
*
* @return The storage array for this ring buffer.
*/
@TestOnly
public short[] getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit AggregatingCharRingBufferTest and run "./gradlew replicateRingBuffers" to regenerate
// ****** Edit TestAggregatingCharRingBuffer and run "./gradlew replicateRingBuffers" to regenerate
//
// @formatter:off
package io.deephaven.base.ringbuffer;
Expand All @@ -12,7 +12,7 @@
import java.util.NoSuchElementException;
import java.util.Random;

public class AggregatingByteRingBufferTest extends TestCase {
public class TestAggregatingByteRingBuffer extends TestCase {

private void assertEmpty(AggregatingByteRingBuffer rb) {
assertTrue(rb.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.util.NoSuchElementException;
import java.util.Random;

public class AggregatingCharRingBufferTest extends TestCase {
public class TestAggregatingCharRingBuffer extends TestCase {

private void assertEmpty(AggregatingCharRingBuffer rb) {
assertTrue(rb.isEmpty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit AggregatingCharRingBufferTest and run "./gradlew replicateRingBuffers" to regenerate
// ****** Edit TestAggregatingCharRingBuffer and run "./gradlew replicateRingBuffers" to regenerate
//
// @formatter:off
package io.deephaven.base.ringbuffer;
Expand All @@ -12,7 +12,7 @@
import java.util.NoSuchElementException;
import java.util.Random;

public class AggregatingDoubleRingBufferTest extends TestCase {
public class TestAggregatingDoubleRingBuffer extends TestCase {

private void assertEmpty(AggregatingDoubleRingBuffer rb) {
assertTrue(rb.isEmpty());
Expand Down
Loading