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

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

Merged
merged 3 commits into from
Aug 26, 2021
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
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