Skip to content

Commit

Permalink
Disambiguate DynamicTableWriter constructors taking an array from the…
Browse files Browse the repository at this point in the history
… point of view of jpy. (#1143)

* Disambiguate DynamicTableWriter constructors taking an array from the point of view of jpy.

* Followup to review comments.

* Spotlessfy.
  • Loading branch information
jcferretti authored Aug 26, 2021
1 parent 590a746 commit 602dfd9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
17 changes: 13 additions & 4 deletions DB/src/main/java/io/deephaven/db/v2/utils/AsyncErrorLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package io.deephaven.db.v2.utils;

import io.deephaven.qst.column.header.ColumnHeader;
import io.deephaven.qst.table.TableHeader;
import io.deephaven.tablelogger.RowSetter;
import io.deephaven.db.tables.utils.DBDateTime;
import io.deephaven.db.v2.DynamicTable;
Expand All @@ -14,10 +16,17 @@
public class AsyncErrorLogger {

private static final DynamicTableWriter tableWriter = new DynamicTableWriter(
new String[] {"Time", "EvaluationNumber", "OperationNumber", "Description", "SourceQueryEvaluationNumber",
"SourceQueryOperationNumber", "SourceQueryDescription", "Cause", "WorkerName", "HostName"},
new Class[] {DBDateTime.class, int.class, int.class, String.class, int.class, int.class, String.class,
Exception.class, String.class, String.class});
TableHeader.of(
ColumnHeader.of("Time", DBDateTime.class),
ColumnHeader.ofInt("EvaluationNumber"),
ColumnHeader.ofInt("OperationNumber"),
ColumnHeader.ofString("Description"),
ColumnHeader.ofInt("SourceQueryEvaluationNumber"),
ColumnHeader.ofInt("SourceQueryOperationNumber"),
ColumnHeader.ofString("SourceQueryDescription"),
ColumnHeader.of("Cause", Exception.class),
ColumnHeader.ofString("WorkerName"),
ColumnHeader.ofString("HostName")));
private static final RowSetter<DBDateTime> timeSetter = tableWriter.getSetter("Time");
private static final RowSetter<Integer> evaluationNumberSetter = tableWriter.getSetter("EvaluationNumber");
private static final RowSetter<Integer> operationNumberSetter = tableWriter.getSetter("OperationNumber");
Expand Down
25 changes: 10 additions & 15 deletions DB/src/main/java/io/deephaven/db/v2/utils/DynamicTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ public DynamicTableWriter(final TableHeader header) {
this(header, Collections.emptyMap());
}

/**
* Creates a TableWriter that produces an in-memory table using the provided column names and types.
*
* @param columnNames the names of the columns in the output table (and our input)
* @param columnTypes the types of the columns in the output table (must be compatible with the input)
* @param constantValues a Map of columns with constant values
*/
// This constructor is no longer public to simplify access from python: jpy cannot resolve
// calls with arguments of list type when there is more than one alternative with array element type
// on the java side. Prefer the constructor taking qst.table.TableHeader or an array of qst.type.Type
// objects.
@SuppressWarnings("WeakerAccess")
public DynamicTableWriter(
DynamicTableWriter(
final String[] columnNames,
final Class<?>[] columnTypes,
final Map<String, Object> constantValues) {
Expand All @@ -93,13 +90,11 @@ public DynamicTableWriter(
this(columnNames, (int i) -> columnTypes[i].clazz(), constantValues);
}

/**
* Creates a TableWriter that produces an in-memory table using the provided column names and types.
*
* @param columnNames the names of the columns in the output table (and our input)
* @param columnTypes the types of the columns in the output table (must be compatible with the input)
*/
public DynamicTableWriter(final String[] columnNames, final Class<?>[] columnTypes) {
// This constructor is no longer public to simplify access from python: jpy cannot resolve
// calls with arguments of list type when there is more than one alternative with array element type
// on the java side. Prefer the constructor taking qst.table.TableHeader or an array of qst.type.Type
// objects.
DynamicTableWriter(final String[] columnNames, final Class<?>[] columnTypes) {
this(columnNames, columnTypes, Collections.emptyMap());
}

Expand Down

0 comments on commit 602dfd9

Please sign in to comment.