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

Select/Update/DateTime Bechmark Improvements #185

Merged
merged 12 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -13,7 +13,7 @@ public class DateTimeFormulaTest {

@Test
public void now() {
setup(6, 40, 5);
setup(6, 35, 15);
var q = "source.update(formulas=['New1 = now()'])";
runner.test("Now- now()", q, "int250");
}
Expand All @@ -27,22 +27,24 @@ public void parseInstant() {

@Test
public void parseDuration() {
setup(3, 10, 2);
setup(2, 9, 1);
var q = "source.update(formulas=['New1 = parseDuration(`PT4H52M14S`)'])";
runner.test("ParseDuration- PT Duration String", q, "int250");
}

@Test
public void parseLocalTime() {
setup(3, 10, 1);
setup(2, 7, 1);
var q = "source.update(formulas=['New1 = parseLocalTime(`04:52:14.001`)'])";
runner.test("ParseLocalTime- Time String)", q, "int250");
}

@Test
public void epochNanosToZonedDateTime() {
setup(3, 8, 5);
var q = "source.update(formulas=['New1 = epochNanosToZonedDateTime(1000000, java.time.ZoneId.systemDefault())'])";
setup(2, 11, 10);
var q = """
source.update(formulas=['New1=epochNanosToZonedDateTime(1697240421926014741L,java.time.ZoneOffset.UTC)'])
""";
runner.test("EpochNanosToZonedDateTime- Nanos Long and ZoneId", q, "int250");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/* Copyright (c) 2022-2023 Deephaven Data Labs and Patent Pending */
package io.deephaven.benchmark.tests.standard.formula;

import org.junit.jupiter.api.*;
import io.deephaven.benchmark.tests.standard.StandardTestRunner;

/**
* Standard tests for running basic formulas (not functions) inline for select, update, view, update_view, etc. These
* tests aggregate the resulting values to make sure the formulas are actually run (as in the case of views). These
* tests are meant to be compared, and so use the same data.
*/
public class InlineFormulaTest {
stanbrub marked this conversation as resolved.
Show resolved Hide resolved
final StandardTestRunner runner = new StandardTestRunner(this);
final String calc1col1 = "'New1 = (float)((int640 + int640) / 2)'";
final String calc1cols2 = "'New1 = (float)((int640 + int250) / 2)'";
final String calc2cols2 = "'New1 = (float)((int640 + int250) / 2)', 'New2 = int640 - int250'";

@BeforeEach
public void setup() {
runner.tables("source");
}

@Test
public void select1Calc1ColFormula() {
runner.setScaleFactors(160, 60);
var q = "source.select(['int640',${calcs}]).sum_by()".replace("${calcs}", calc1col1);
runner.test("Select-Sum- 1 Calc Using 1 Col", 1, q, "int640");
}

@Test
public void select1Calc2ColsFormula() {
runner.setScaleFactors(120, 50);
var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc1cols2);
runner.test("Select-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void select2Calcs2ColsFormula() {
runner.setScaleFactors(120, 50);
var q = "source.select(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc2cols2);
runner.test("Select-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void update1Calc1ColsFormula() {
runner.setScaleFactors(160, 130);
var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc1col1);
runner.test("Update-Sum- 1 Calc Using 1 Col", 1, q, "int640");
}

@Test
public void update1Calc2ColsFormula() {
runner.setScaleFactors(140, 100);
var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc1cols2);
runner.test("Update-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void update2Calcs2ColsFormula() {
runner.setScaleFactors(110, 80);
var q = "source.update([${calcs}]).sum_by()".replace("${calcs}", calc2cols2);
runner.test("Update-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void view1Calc1ColFormula() {
runner.setScaleFactors(130, 120);
var q = "source.view(['int640',${calcs}]).sum_by()".replace("${calcs}", calc1col1);
runner.test("View-Sum- 1 Calc Using 1 Col", 1, q, "int640");
}

@Test
public void view1Calc2ColsFormula() {
runner.setScaleFactors(120, 120);
var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc1cols2);
runner.test("View-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void view2Calcs2ColsFormula() {
runner.setScaleFactors(120, 100);
var q = "source.view(['int250','int640',${calcs}]).sum_by()".replace("${calcs}", calc2cols2);
runner.test("View-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void updateView1Calc1ColFormula() {
runner.setScaleFactors(140, 140);
var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc1col1);
runner.test("UpdateView-Sum- 1 Calc Using 1 Col", 1, q, "int640");
}

@Test
public void updateView1Calc2ColsFormula() {
runner.setScaleFactors(120, 120);
var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc1cols2);
runner.test("UpdateView-Sum- 1 Calc Using 2 Cols", 1, q, "int250", "int640");
}

@Test
public void updateView2Calcs2ColsFormula() {
runner.setScaleFactors(120, 120);
var q = "source.update_view([${calcs}]).sum_by()".replace("${calcs}", calc2cols2);
runner.test("UpdateView-Sum- 2 Calcs Using 2 Cols", 1, q, "int250", "int640");
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.