Skip to content

Commit

Permalink
Merge branch 'main' into javadoc-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Jun 2, 2023
2 parents aada76f + a4676d8 commit 86ddb41
Show file tree
Hide file tree
Showing 2,194 changed files with 148,418 additions and 136,959 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
/docker @devinrsmith @jcferretti @rcaudy
/engine/function/ @chipkent @kosak @rcaudy
/py @chipkent @jmao-denver @rcaudy
*.proto @devinrsmith @nbauernfeind @niloc132 @rcaudy
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
*/
package io.deephaven.benchmarking;

import io.deephaven.configuration.Configuration;
import io.deephaven.configuration.DataDir;
import io.deephaven.engine.context.ExecutionContext;
import io.deephaven.engine.table.ColumnDefinition;
import io.deephaven.engine.table.Table;
import io.deephaven.engine.table.TableDefinition;
import io.deephaven.time.DateTime;
import io.deephaven.util.annotations.ScriptApi;
import io.deephaven.benchmarking.generator.*;
import io.deephaven.benchmarking.impl.PersistentBenchmarkTableBuilder;
Expand All @@ -18,6 +16,7 @@
import org.openjdk.jmh.infra.BenchmarkParams;

import java.nio.file.Path;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -147,24 +146,24 @@ public static ColumnGenerator<Character> charCol(String name, char min, char max

/**
* @param name The name of the column
* @return a {@link ColumnGenerator< DateTime >} for use with
* @return a {@link ColumnGenerator< Instant >} for use with
* {@link BenchmarkTableBuilder#addColumn(ColumnGenerator)}
*/
@ScriptApi
public static ColumnGenerator<DateTime> dateCol(String name) {
return new DateColumnGenerator(name);
public static ColumnGenerator<Instant> instantCol(String name) {
return new InstantColumnGenerator(name);
}

/**
* @param name The name of the column
* @param min the minimum value
* @param max the maximum value
* @return a {@link ColumnGenerator< DateTime >} for use with
* @return a {@link ColumnGenerator< Instant >} for use with
* {@link BenchmarkTableBuilder#addColumn(ColumnGenerator)}
*/
@ScriptApi
public static ColumnGenerator<DateTime> dateCol(String name, DateTime min, DateTime max) {
return new DateColumnGenerator(name, min, max);
public static ColumnGenerator<Instant> instantCol(String name, Instant min, Instant max) {
return new InstantColumnGenerator(name, min, max);
}

/**
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
*/
package io.deephaven.benchmarking.generator;

import io.deephaven.engine.table.ColumnDefinition;
import io.deephaven.time.DateTimeUtils;
import io.deephaven.benchmarking.generator.random.ExtendedRandom;

import java.time.Instant;

public class InstantColumnGenerator implements ColumnGenerator<Instant> {

private NumGenerator gen;
private final ColumnDefinition<Instant> def;
private final long min;
private final long max;

public InstantColumnGenerator(String name) {
this(name, 0, Long.MAX_VALUE);
}

public InstantColumnGenerator(String name, Instant min, Instant max) {
this(name, DateTimeUtils.epochNanos(min), DateTimeUtils.epochNanos(max));
}

private InstantColumnGenerator(String name, long min, long max) {
def = ColumnDefinition.ofTime(name);
this.min = min;
this.max = max;
}

@Override
public ColumnDefinition<Instant> getDefinition() {
return def;
}

@Override
public String getUpdateString(String varName) {
return def.getName() + "=(DateTime)" + varName + ".get()";
}

@Override
public String getName() {
return def.getName();
}

@Override
public void init(ExtendedRandom random) {
gen = new NumGenerator(min, max, random);
}

public Instant get() {
return DateTimeUtils.epochNanosToInstant(gen.getLong());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.deephaven.clientsupport.gotorow;

import java.time.Instant;
import java.util.function.Function;
import gnu.trove.set.TLongSet;
import gnu.trove.set.hash.TLongHashSet;
Expand All @@ -12,7 +13,7 @@
import io.deephaven.engine.table.Table;
import io.deephaven.internal.log.LoggerFactory;
import io.deephaven.io.logger.Logger;
import io.deephaven.time.DateTime;
import io.deephaven.time.DateTimeUtils;

import java.util.Random;

Expand Down Expand Up @@ -112,10 +113,10 @@ public Long apply(Table table) {
log.info().append("Using numerical distance (").appendDouble(dl).append(", ").appendDouble(du)
.append(")").endl();
return index.find(du < dl ? closestUpperRowYet : closestLowerRowYet);
} else if (DateTime.class.isAssignableFrom(columnType)) {
long nu = ((DateTime) closestUpperValueYet).getNanos();
long nl = ((DateTime) closestLowerValueYet).getNanos();
long ns = ((DateTime) seekValue).getNanos();
} else if (Instant.class.isAssignableFrom(columnType)) {
long nu = DateTimeUtils.epochNanos(((Instant) closestUpperValueYet));
long nl = DateTimeUtils.epochNanos(((Instant) closestLowerValueYet));
long ns = DateTimeUtils.epochNanos(((Instant) seekValue));
long du = Math.abs(nu - ns);
long dl = Math.abs(nl - ns);
log.info().append("Using nano distance (").append(dl).append(", ").append(du).append(")").endl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import io.deephaven.engine.rowset.chunkattributes.OrderedRowKeys;
import io.deephaven.internal.log.LoggerFactory;
import io.deephaven.function.Numeric;
import io.deephaven.time.DateTime;
import io.deephaven.hash.KeyedLongObjectHash;
import io.deephaven.hash.KeyedLongObjectHashMap;
import io.deephaven.hash.KeyedLongObjectKey;
Expand All @@ -30,6 +29,7 @@
import org.apache.commons.lang3.mutable.MutableObject;
import org.jetbrains.annotations.Nullable;

import java.time.Instant;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
Expand Down Expand Up @@ -275,7 +275,9 @@ public BucketState newValue(final Long key) {
}
};

private DownsamplerListener(final QueryTable sourceTable, final QueryTable resultTable,
private DownsamplerListener(
final QueryTable sourceTable,
final QueryTable resultTable,
final DownsampleKey key) {
super("downsample listener", sourceTable, resultTable);
this.sourceTable = sourceTable;
Expand All @@ -284,14 +286,14 @@ private DownsamplerListener(final QueryTable sourceTable, final QueryTable resul
this.key = key;

final ColumnSource xSource = sourceTable.getColumnSource(key.xColumnName);
if (xSource.getType() == DateTime.class) {
this.xColumnSource = ReinterpretUtils.dateTimeToLongSource(xSource);
if (xSource.getType() == Instant.class) {
this.xColumnSource = ReinterpretUtils.instantToLongSource(xSource);
} else if (xSource.allowsReinterpret(long.class)) {
// noinspection unchecked
this.xColumnSource = xSource.reinterpret(long.class);
} else {
throw new IllegalArgumentException(
"Cannot use non-DateTime, non-long x column " + key.xColumnName + " in downsample");
"Cannot use non-Instant, non-long x column " + key.xColumnName + " in downsample");
}

this.valueColumnSources = Arrays.stream(this.key.yColumnNames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.jetbrains.annotations.NotNull;

import java.io.*;
import java.time.ZoneId;
import java.util.*;

/**
Expand Down Expand Up @@ -160,7 +161,7 @@ private static String getRootPath() {
* @return the TimeZone the server is running in
*/
public TimeZone getServerTimezone() {
return TimeZone.getTimeZone(getProperty("server.timezone"));
return TimeZone.getTimeZone(ZoneId.systemDefault());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,20 @@ public Boolean isTime() {
}
});

types.put("DateTime", new Type() {
types.put("Instant", new Type() {
@Override
public String getGenericSignature(int index) {
return null;
}

@Override
public String getVariableType(int index) {
return "DateTime[]";
return "Instant[]";
}

@Override
public String getIndexableDataCode(String variableName) {
return "new IndexableNumericDataArrayDateTime(" + variableName + ", " + PLOT_INFO_ID + ")";
return "new IndexableNumericDataArrayInstant(" + variableName + ", " + PLOT_INFO_ID + ")";
}

@Override
Expand Down Expand Up @@ -568,7 +568,7 @@ private static ArrayList<ArrayList<Type>> constructRestrictedNumericalTypes(fina

private static final String[] timeTypes = {
"Date",
"DateTime"
"Instant"
};

private static final String[] numberTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,8 @@ private static Map<String, PyArg> getPyArgs() {
final String[] taTable = new String[] {"Table", "SelectableDataSet"};

final String[] taDataCategory = new String[] {"str", "List[str]", "List[int]", "List[float]"};
final String[] taDataNumeric = new String[] {"str", "List[int]", "List[float]", "List[DateTime]"};
final String[] taDataTime = new String[] {"str", "List[DateTime]"};
final String[] taDataNumeric = new String[] {"str", "List[int]", "List[float]", "List[Instant]"};
final String[] taDataTime = new String[] {"str", "List[Instant]"};
final String[] taMultiSeriesKey = new String[] {"List[Any]"}; // todo keys are technically Object[]. How to
// support?
final String[] taColor = new String[] {"str", "int", "Color"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from deephaven import DHError, dtypes
from deephaven._wrapper import JObjectWrapper
from deephaven.dtypes import DateTime, PyObject
from deephaven.dtypes import Instant, PyObject
from deephaven.plot import LineStyle, PlotStyle, Color, Font, AxisFormat, Shape, AxisTransform, \
SelectableDataSet
from deephaven.table import Table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
*/
package io.deephaven.integrations.common;

import io.deephaven.time.DateTime;
import io.deephaven.time.DateTimeUtils;
import io.deephaven.util.BooleanUtils;

import java.time.Instant;

/**
* General purpose helper methods for array conversion methods from specific object types to/from primitive types. This
* is specifically intended to improve performance in integration with Python, where conversion of primitive type arrays
Expand Down Expand Up @@ -44,31 +45,31 @@ public static Boolean[] translateArrayByteToBoolean(final byte[] array) {
}

/**
* Translates a DateTime array to a long array. The mapping will be performed according to
* {@link DateTimeUtils#nanos(DateTime)}. This is the (psuedo)inverse of `translateArrayLongToDateTime`.
* Translates an Instant array to a long array. The mapping will be performed according to
* {@link DateTimeUtils#epochNanos(Instant)}. This is the (psuedo)inverse of `translateArrayLongToInstant`.
*
* @param array - the DateTime array
* @param array - the Instant array
* @return the corresponding long array
*/
public static long[] translateArrayDateTimeToLong(final DateTime[] array) {
public static long[] translateArrayInstantToLong(final Instant[] array) {
final long[] out = new long[array.length];
for (int ai = 0; ai < array.length; ai++) {
out[ai] = DateTimeUtils.nanos(array[ai]);
out[ai] = DateTimeUtils.epochNanos(array[ai]);
}
return out;
}

/**
* Translates a long array to a DateTime array. The mapping will be performed according to
* {@link DateTimeUtils#nanosToTime(long)}. This is the (psuedo)inverse of `translateArrayLongToDateTime`.
* Translates a long array to an Instant array. The mapping will be performed according to
* {@link DateTimeUtils#epochNanosToInstant(long)}. This is the (psuedo)inverse of `translateArrayLongToInstant`.
*
* @param array - the long array
* @return the corresponding DateTime array
*/
public static DateTime[] translateArrayLongToDateTime(final long[] array) {
final DateTime[] out = new DateTime[array.length];
public static Instant[] translateArrayLongToInstant(final long[] array) {
final Instant[] out = new Instant[array.length];
for (int ai = 0; ai < array.length; ai++) {
out[ai] = DateTimeUtils.nanosToTime(array[ai]);
out[ai] = DateTimeUtils.epochNanosToInstant(array[ai]);
}
return out;
}
Expand Down
Loading

0 comments on commit 86ddb41

Please sign in to comment.