From 9ee6a6e66915afc3b8b77ad24be74a1456948d5a Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 13 Aug 2024 00:03:50 -0700 Subject: [PATCH 01/18] Expose members --- .../impl/locations/impl/CompositeTableDataService.java | 8 ++++---- .../impl/locations/impl/FilteredTableDataService.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index e9dbbc747ce..f877e43a30a 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -23,7 +23,7 @@ public class CompositeTableDataService extends AbstractTableDataService { private static final String IMPLEMENTATION_NAME = CompositeTableDataService.class.getSimpleName(); - private final ServiceSelector serviceSelector; + protected final ServiceSelector serviceSelector; public interface ServiceSelector { @@ -78,14 +78,14 @@ protected TableLocationProvider makeTableLocationProvider(@NotNull final TableKe return new TableLocationProviderImpl(services, tableKey); } - private class TableLocationProviderImpl implements TableLocationProvider { + protected class TableLocationProviderImpl implements TableLocationProvider { private final ImmutableTableKey tableKey; - private final List inputProviders; + protected final List inputProviders; private final String implementationName; - private TableLocationProviderImpl(@NotNull final TableDataService[] inputServices, + protected TableLocationProviderImpl(@NotNull final TableDataService[] inputServices, @NotNull final TableKey tableKey) { this.tableKey = tableKey.makeImmutable(); inputProviders = Arrays.stream(inputServices).map(s -> s.getTableLocationProvider(this.tableKey)) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 8bfbeed184a..90769dd398a 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -21,7 +21,7 @@ public class FilteredTableDataService extends AbstractTableDataService { private static final String IMPLEMENTATION_NAME = FilteredTableDataService.class.getSimpleName(); - private final TableDataService serviceToFilter; + protected final TableDataService serviceToFilter; private final LocationKeyFilter locationKeyFilter; @FunctionalInterface @@ -65,14 +65,14 @@ protected TableLocationProvider makeTableLocationProvider(@NotNull final TableKe return new TableLocationProviderImpl(serviceToFilter.getTableLocationProvider(tableKey)); } - private class TableLocationProviderImpl implements TableLocationProvider { + protected class TableLocationProviderImpl implements TableLocationProvider { - private final TableLocationProvider inputProvider; + protected final TableLocationProvider inputProvider; private final String implementationName; private final Map listeners = new WeakHashMap<>(); - private TableLocationProviderImpl(@NotNull final TableLocationProvider inputProvider) { + protected TableLocationProviderImpl(@NotNull final TableLocationProvider inputProvider) { this.inputProvider = inputProvider; implementationName = "Filtered-" + inputProvider.getImplementationName(); } From e3ea4239e899dbb30aa5340141b9cabcf4d84eaa Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Mon, 19 Aug 2024 20:29:54 -0700 Subject: [PATCH 02/18] Revert "Expose members" This reverts commit 9ee6a6e66915afc3b8b77ad24be74a1456948d5a. --- .../impl/locations/impl/CompositeTableDataService.java | 8 ++++---- .../impl/locations/impl/FilteredTableDataService.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index f877e43a30a..e9dbbc747ce 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -23,7 +23,7 @@ public class CompositeTableDataService extends AbstractTableDataService { private static final String IMPLEMENTATION_NAME = CompositeTableDataService.class.getSimpleName(); - protected final ServiceSelector serviceSelector; + private final ServiceSelector serviceSelector; public interface ServiceSelector { @@ -78,14 +78,14 @@ protected TableLocationProvider makeTableLocationProvider(@NotNull final TableKe return new TableLocationProviderImpl(services, tableKey); } - protected class TableLocationProviderImpl implements TableLocationProvider { + private class TableLocationProviderImpl implements TableLocationProvider { private final ImmutableTableKey tableKey; - protected final List inputProviders; + private final List inputProviders; private final String implementationName; - protected TableLocationProviderImpl(@NotNull final TableDataService[] inputServices, + private TableLocationProviderImpl(@NotNull final TableDataService[] inputServices, @NotNull final TableKey tableKey) { this.tableKey = tableKey.makeImmutable(); inputProviders = Arrays.stream(inputServices).map(s -> s.getTableLocationProvider(this.tableKey)) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 90769dd398a..8bfbeed184a 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -21,7 +21,7 @@ public class FilteredTableDataService extends AbstractTableDataService { private static final String IMPLEMENTATION_NAME = FilteredTableDataService.class.getSimpleName(); - protected final TableDataService serviceToFilter; + private final TableDataService serviceToFilter; private final LocationKeyFilter locationKeyFilter; @FunctionalInterface @@ -65,14 +65,14 @@ protected TableLocationProvider makeTableLocationProvider(@NotNull final TableKe return new TableLocationProviderImpl(serviceToFilter.getTableLocationProvider(tableKey)); } - protected class TableLocationProviderImpl implements TableLocationProvider { + private class TableLocationProviderImpl implements TableLocationProvider { - protected final TableLocationProvider inputProvider; + private final TableLocationProvider inputProvider; private final String implementationName; private final Map listeners = new WeakHashMap<>(); - protected TableLocationProviderImpl(@NotNull final TableLocationProvider inputProvider) { + private TableLocationProviderImpl(@NotNull final TableLocationProvider inputProvider) { this.inputProvider = inputProvider; implementationName = "Filtered-" + inputProvider.getImplementationName(); } From d4d2c8a977b9bda21811aae0f59d41399c891a5c Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Mon, 19 Aug 2024 22:13:22 -0700 Subject: [PATCH 03/18] Add getRawTableLocationProvider --- .../impl/locations/TableDataService.java | 16 ++++++++++ .../impl/CompositeTableDataService.java | 31 +++++++++++++++++++ .../impl/FilteredTableDataService.java | 7 +++++ 3 files changed, 54 insertions(+) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index ccd392534be..986267b512a 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -20,6 +20,22 @@ public interface TableDataService { @NotNull TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); + /** + * Request a raw {@link TableLocationProvider} from this service. A raw {@link TableLocationProvider} does not + * compose and/or delegate to other {@link TableLocationProvider}s. + * + * @param tableKey The {@link TableKey} to lookup + * @param tableLocationKey The {@link TableLocationKey} to lookup + * @return A raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or + * null if either key is not present + * @implSpec Non-raw {@link TableLocationProvider}s must implement this method. + */ + @Nullable + default TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, + @NotNull TableLocationKey tableLocationKey) { + return getTableLocationProvider(tableKey); + } + /** * Forget all state for subsequent requests for all tables. */ diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index e9dbbc747ce..1ff180dd3c7 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -53,6 +53,37 @@ public CompositeTableDataService(@NotNull String name, @NotNull final ServiceSel this.serviceSelector = Require.neqNull(serviceSelector, "serviceSelector"); } + @Override + @Nullable + public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, + @NotNull TableLocationKey tableLocationKey) { + final TableDataService[] services = serviceSelector.call(tableKey); + + if (services == null || services.length == 0) { + return null; + } + + TableLocationProvider tlp = null; + for (final TableDataService service : services) { + final TableLocationProvider tlpCandidate = service.getRawTableLocationProvider(tableKey, tableLocationKey); + if (tlpCandidate == null) { + return null; + } + + if (tlpCandidate.hasTableLocationKey(tableLocationKey)) { + if (tlp != null) { + throw new TableDataException( + "TableDataService elements " + tlpCandidate.getName() + " and " + tlp.getName() + + " both contain " + tableLocationKey + ". Full TableDataService configuration:\n" + + Formatter.formatTableDataService(CompositeTableDataService.this.toString())); + } + tlp = tlpCandidate; + } + } + + return tlp; + } + @Override public void reset() { super.reset(); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 8bfbeed184a..7a7141261f5 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -47,6 +47,13 @@ public FilteredTableDataService(@NotNull final TableDataService serviceToFilter, this.locationKeyFilter = Require.neqNull(locationKeyFilter, "locationKeyFilter"); } + @Override + @Nullable + public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, + @NotNull TableLocationKey tableLocationKey) { + return serviceToFilter.getRawTableLocationProvider(tableKey, tableLocationKey); + } + @Override public void reset() { super.reset(); From aed074072906f845f0f5c5fac26c90b3bfd74f70 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 20 Aug 2024 11:18:06 -0700 Subject: [PATCH 04/18] Improve filtered TDS impl --- .../table/impl/locations/impl/FilteredTableDataService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 7a7141261f5..00afbee24b0 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -51,6 +51,10 @@ public FilteredTableDataService(@NotNull final TableDataService serviceToFilter, @Nullable public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, @NotNull TableLocationKey tableLocationKey) { + if (!locationKeyFilter.accept(tableLocationKey)) { + return null; + } + return serviceToFilter.getRawTableLocationProvider(tableKey, tableLocationKey); } From b2269f6152974a60175c75441975039c1b548ce3 Mon Sep 17 00:00:00 2001 From: arman-ddl <122062464+arman-ddl@users.noreply.github.com> Date: Thu, 29 Aug 2024 07:33:44 -0700 Subject: [PATCH 05/18] Apply suggestions from code review Per Darin and Ryan Co-authored-by: Ryan Caudy Co-authored-by: Darin Petty --- .../engine/table/impl/locations/TableDataService.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index 986267b512a..fea03e2f216 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,14 +21,15 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request a raw {@link TableLocationProvider} from this service. A raw {@link TableLocationProvider} does not - * compose and/or delegate to other {@link TableLocationProvider}s. + * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does not + * compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup * @return A raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or - * null if either key is not present - * @implSpec Non-raw {@link TableLocationProvider}s must implement this method. + * {@code null} if either key is not present + * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method. + * @throws TableDataException if the TableLocationKey is provided by more than one TableLocationProvider */ @Nullable default TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, From ddd76f150d2beb219793d11d448848d1425ce92d Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Thu, 29 Aug 2024 07:34:07 -0700 Subject: [PATCH 06/18] Fix iteration bug --- .../table/impl/locations/impl/CompositeTableDataService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index 1ff180dd3c7..2833e3ad498 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -67,7 +67,7 @@ public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey table for (final TableDataService service : services) { final TableLocationProvider tlpCandidate = service.getRawTableLocationProvider(tableKey, tableLocationKey); if (tlpCandidate == null) { - return null; + continue; } if (tlpCandidate.hasTableLocationKey(tableLocationKey)) { From a2399e09458af2f7b83349d91a73bf922573faab Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Thu, 29 Aug 2024 08:48:19 -0700 Subject: [PATCH 07/18] Use default NamedImplementation#getImplementationName instead of constants --- .../engine/table/impl/locations/TableDataService.java | 5 +++-- .../locations/impl/CompositeTableDataService.java | 7 ------- .../impl/locations/impl/FilteredTableDataService.java | 7 ------- .../impl/locations/impl/NonexistentTableLocation.java | 7 ------- .../locations/impl/PollingTableLocationProvider.java | 7 ------- .../locations/impl/SingleTableLocationProvider.java | 7 ------- .../table/impl/locations/impl/StandaloneTableKey.java | 11 ++--------- .../impl/locations/local/FileTableLocationKey.java | 7 ------- .../impl/locations/local/URITableLocationKey.java | 7 ------- .../impl/locations/impl/SimpleTableLocationKey.java | 7 ------- .../location/IcebergTableParquetLocationKey.java | 6 ------ .../parquet/table/location/ParquetColumnLocation.java | 7 ------- .../parquet/table/location/ParquetTableLocation.java | 7 ------- .../table/location/ParquetTableLocationKey.java | 7 ------- 14 files changed, 5 insertions(+), 94 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index fea03e2f216..bdd9e629dde 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,8 +21,9 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does not - * compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. + * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for + * {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does + * not compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index 2833e3ad498..0e1bfea1cbb 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -21,8 +21,6 @@ */ public class CompositeTableDataService extends AbstractTableDataService { - private static final String IMPLEMENTATION_NAME = CompositeTableDataService.class.getSimpleName(); - private final ServiceSelector serviceSelector; public interface ServiceSelector { @@ -230,11 +228,6 @@ public TableLocation getTableLocationIfPresent(@NotNull final TableLocationKey t } } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public String toString() { return getImplementationName() + '{' + diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 00afbee24b0..df93b4d5adf 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -19,8 +19,6 @@ */ public class FilteredTableDataService extends AbstractTableDataService { - private static final String IMPLEMENTATION_NAME = FilteredTableDataService.class.getSimpleName(); - private final TableDataService serviceToFilter; private final LocationKeyFilter locationKeyFilter; @@ -200,11 +198,6 @@ public String toString() { } } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public String toString() { return getImplementationName() + '{' + diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java index 26e7ec6c79c..d0ed07ddc0c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java @@ -20,19 +20,12 @@ */ public final class NonexistentTableLocation extends AbstractTableLocation { - private static final String IMPLEMENTATION_NAME = NonexistentTableLocation.class.getSimpleName(); - public NonexistentTableLocation(@NotNull final TableKey tableKey, @NotNull final TableLocationKey tableLocationKey) { super(tableKey, tableLocationKey, false); handleUpdate(RowSetFactory.empty(), NULL_TIME); } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public void refresh() {} diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java index 361a18c8c44..6d7d1d53310 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java @@ -19,8 +19,6 @@ public class PollingTableLocationProvider extends AbstractTableLocationProvider { - private static final String IMPLEMENTATION_NAME = PollingTableLocationProvider.class.getSimpleName(); - private final TableLocationKeyFinder locationKeyFinder; private final TableLocationFactory locationFactory; private final TableDataRefreshService refreshService; @@ -41,11 +39,6 @@ public PollingTableLocationProvider(@NotNull final TK tableKey, // AbstractTableLocationProvider implementation // ------------------------------------------------------------------------------------------------------------------ - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public void refresh() { locationKeyFinder.findKeys(this::handleTableLocationKey); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java index a94abd87f5f..8f79915902c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java @@ -15,8 +15,6 @@ */ public final class SingleTableLocationProvider implements TableLocationProvider { - private static final String IMPLEMENTATION_NAME = SingleTableLocationProvider.class.getSimpleName(); - private final TableLocation tableLocation; /** @@ -26,11 +24,6 @@ public SingleTableLocationProvider(@NotNull final TableLocation tableLocation) { this.tableLocation = tableLocation; } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public ImmutableTableKey getKey() { return tableLocation.getTableKey(); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java index c5296387407..2ba41a8be09 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java @@ -17,8 +17,6 @@ @Immutable public final class StandaloneTableKey implements ImmutableTableKey { - private static final String IMPLEMENTATION_NAME = StandaloneTableKey.class.getSimpleName(); - private static final TableKey INSTANCE = new StandaloneTableKey(); public static TableKey getInstance() { @@ -27,19 +25,14 @@ public static TableKey getInstance() { private StandaloneTableKey() {} - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public LogOutput append(LogOutput logOutput) { - return logOutput.append(IMPLEMENTATION_NAME); + return logOutput.append(getImplementationName()); } @Override public String toString() { - return IMPLEMENTATION_NAME; + return getImplementationName(); } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java index 251a1874277..5ae86e97978 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java @@ -22,8 +22,6 @@ */ public class FileTableLocationKey extends PartitionedTableLocationKey { - private static final String IMPLEMENTATION_NAME = FileTableLocationKey.class.getSimpleName(); - protected final File file; private final int order; @@ -115,9 +113,4 @@ public boolean equals(@Nullable final Object other) { final FileTableLocationKey otherTyped = (FileTableLocationKey) other; return file.equals(otherTyped.file) && partitions.equals(otherTyped.partitions); } - - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java index 86f9035d463..524a6d490a7 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java @@ -25,8 +25,6 @@ */ public class URITableLocationKey extends PartitionedTableLocationKey { - private static final String IMPLEMENTATION_NAME = URITableLocationKey.class.getSimpleName(); - protected final URI uri; private final int order; @@ -121,9 +119,4 @@ public boolean equals(@Nullable final Object other) { final URITableLocationKey otherTyped = (URITableLocationKey) other; return uri.equals(otherTyped.uri) && partitions.equals(otherTyped.partitions); } - - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java index 55ebb48429a..0ae291965e0 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java @@ -15,17 +15,10 @@ */ public final class SimpleTableLocationKey extends PartitionedTableLocationKey { - private static final String IMPLEMENTATION_NAME = SimpleTableLocationKey.class.getSimpleName(); - public SimpleTableLocationKey(@Nullable final Map> partitions) { super(partitions); } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public LogOutput append(LogOutput logOutput) { return logOutput.append(getImplementationName()).append("[partitions=") diff --git a/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java b/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java index e356d0ecb92..042af9742a4 100644 --- a/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java +++ b/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java @@ -16,7 +16,6 @@ * {@link TableLocationKey} implementation for use with data stored in Iceberg tables in the parquet format. */ public class IcebergTableParquetLocationKey extends ParquetTableLocationKey implements IcebergTableLocationKey { - private static final String IMPLEMENTATION_NAME = IcebergTableParquetLocationKey.class.getSimpleName(); private final ParquetInstructions readInstructions; @@ -39,11 +38,6 @@ public IcebergTableParquetLocationKey( this.readInstructions = readInstructions; } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public ParquetInstructions readInstructions() { return readInstructions; diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java index 4ddebb33685..b39fc9dfa3e 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java @@ -51,8 +51,6 @@ final class ParquetColumnLocation extends AbstractColumnLocation { - private static final String IMPLEMENTATION_NAME = ParquetColumnLocation.class.getSimpleName(); - private static final int INITIAL_PAGE_CACHE_SIZE = Configuration.getInstance() .getIntegerForClassWithDefault(ParquetColumnLocation.class, "initialPageCacheSize", 128); private static final int MAX_PAGE_CACHE_SIZE = Configuration.getInstance() @@ -107,11 +105,6 @@ private PageCache ensurePageCache() { // AbstractColumnLocation implementation // ----------------------------------------------------------------------------------------------------------------- - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public boolean exists() { // If we see a null columnChunkReaders array, either we don't exist or we are guaranteed to diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java index b782c8488c6..fc19c699d55 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java @@ -54,8 +54,6 @@ public class ParquetTableLocation extends AbstractTableLocation { - private static final String IMPLEMENTATION_NAME = ParquetColumnLocation.class.getSimpleName(); - private final ParquetInstructions readInstructions; private final ParquetFileReader parquetFileReader; private final int[] rowGroupIndices; @@ -128,11 +126,6 @@ public ParquetTableLocation(@NotNull final TableKey tableKey, } } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - @Override public void refresh() {} diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java index cafff0a3210..820fa364a10 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java @@ -31,8 +31,6 @@ */ public class ParquetTableLocationKey extends URITableLocationKey { - private static final String IMPLEMENTATION_NAME = ParquetTableLocationKey.class.getSimpleName(); - private ParquetFileReader fileReader; private ParquetMetadata metadata; private int[] rowGroupIndices; @@ -86,11 +84,6 @@ private static URI validateParquetFile(@NotNull final URI parquetFileUri) { return parquetFileUri; } - @Override - public String getImplementationName() { - return IMPLEMENTATION_NAME; - } - /** * Get a previously-{@link #setFileReader(ParquetFileReader) set} or on-demand created {@link ParquetFileReader} for * this location key's {@code file}. From 5a86f98e92ba45afcf702a30dce87915bbba6fe6 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Thu, 29 Aug 2024 15:03:12 -0700 Subject: [PATCH 08/18] Revert "Use default NamedImplementation#getImplementationName instead of constants" This reverts commit a2399e09458af2f7b83349d91a73bf922573faab. --- .../engine/table/impl/locations/TableDataService.java | 5 ++--- .../locations/impl/CompositeTableDataService.java | 7 +++++++ .../impl/locations/impl/FilteredTableDataService.java | 7 +++++++ .../impl/locations/impl/NonexistentTableLocation.java | 7 +++++++ .../locations/impl/PollingTableLocationProvider.java | 7 +++++++ .../locations/impl/SingleTableLocationProvider.java | 7 +++++++ .../table/impl/locations/impl/StandaloneTableKey.java | 11 +++++++++-- .../impl/locations/local/FileTableLocationKey.java | 7 +++++++ .../impl/locations/local/URITableLocationKey.java | 7 +++++++ .../impl/locations/impl/SimpleTableLocationKey.java | 7 +++++++ .../location/IcebergTableParquetLocationKey.java | 6 ++++++ .../parquet/table/location/ParquetColumnLocation.java | 7 +++++++ .../parquet/table/location/ParquetTableLocation.java | 7 +++++++ .../table/location/ParquetTableLocationKey.java | 7 +++++++ 14 files changed, 94 insertions(+), 5 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index bdd9e629dde..fea03e2f216 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,9 +21,8 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for - * {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does - * not compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. + * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does not + * compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index 0e1bfea1cbb..2833e3ad498 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -21,6 +21,8 @@ */ public class CompositeTableDataService extends AbstractTableDataService { + private static final String IMPLEMENTATION_NAME = CompositeTableDataService.class.getSimpleName(); + private final ServiceSelector serviceSelector; public interface ServiceSelector { @@ -228,6 +230,11 @@ public TableLocation getTableLocationIfPresent(@NotNull final TableLocationKey t } } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public String toString() { return getImplementationName() + '{' + diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index df93b4d5adf..00afbee24b0 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -19,6 +19,8 @@ */ public class FilteredTableDataService extends AbstractTableDataService { + private static final String IMPLEMENTATION_NAME = FilteredTableDataService.class.getSimpleName(); + private final TableDataService serviceToFilter; private final LocationKeyFilter locationKeyFilter; @@ -198,6 +200,11 @@ public String toString() { } } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public String toString() { return getImplementationName() + '{' + diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java index d0ed07ddc0c..26e7ec6c79c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/NonexistentTableLocation.java @@ -20,12 +20,19 @@ */ public final class NonexistentTableLocation extends AbstractTableLocation { + private static final String IMPLEMENTATION_NAME = NonexistentTableLocation.class.getSimpleName(); + public NonexistentTableLocation(@NotNull final TableKey tableKey, @NotNull final TableLocationKey tableLocationKey) { super(tableKey, tableLocationKey, false); handleUpdate(RowSetFactory.empty(), NULL_TIME); } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public void refresh() {} diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java index 6d7d1d53310..361a18c8c44 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/PollingTableLocationProvider.java @@ -19,6 +19,8 @@ public class PollingTableLocationProvider extends AbstractTableLocationProvider { + private static final String IMPLEMENTATION_NAME = PollingTableLocationProvider.class.getSimpleName(); + private final TableLocationKeyFinder locationKeyFinder; private final TableLocationFactory locationFactory; private final TableDataRefreshService refreshService; @@ -39,6 +41,11 @@ public PollingTableLocationProvider(@NotNull final TK tableKey, // AbstractTableLocationProvider implementation // ------------------------------------------------------------------------------------------------------------------ + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public void refresh() { locationKeyFinder.findKeys(this::handleTableLocationKey); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java index 8f79915902c..a94abd87f5f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/SingleTableLocationProvider.java @@ -15,6 +15,8 @@ */ public final class SingleTableLocationProvider implements TableLocationProvider { + private static final String IMPLEMENTATION_NAME = SingleTableLocationProvider.class.getSimpleName(); + private final TableLocation tableLocation; /** @@ -24,6 +26,11 @@ public SingleTableLocationProvider(@NotNull final TableLocation tableLocation) { this.tableLocation = tableLocation; } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public ImmutableTableKey getKey() { return tableLocation.getTableKey(); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java index 2ba41a8be09..c5296387407 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/StandaloneTableKey.java @@ -17,6 +17,8 @@ @Immutable public final class StandaloneTableKey implements ImmutableTableKey { + private static final String IMPLEMENTATION_NAME = StandaloneTableKey.class.getSimpleName(); + private static final TableKey INSTANCE = new StandaloneTableKey(); public static TableKey getInstance() { @@ -25,14 +27,19 @@ public static TableKey getInstance() { private StandaloneTableKey() {} + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public LogOutput append(LogOutput logOutput) { - return logOutput.append(getImplementationName()); + return logOutput.append(IMPLEMENTATION_NAME); } @Override public String toString() { - return getImplementationName(); + return IMPLEMENTATION_NAME; } @Override diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java index 5ae86e97978..251a1874277 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/FileTableLocationKey.java @@ -22,6 +22,8 @@ */ public class FileTableLocationKey extends PartitionedTableLocationKey { + private static final String IMPLEMENTATION_NAME = FileTableLocationKey.class.getSimpleName(); + protected final File file; private final int order; @@ -113,4 +115,9 @@ public boolean equals(@Nullable final Object other) { final FileTableLocationKey otherTyped = (FileTableLocationKey) other; return file.equals(otherTyped.file) && partitions.equals(otherTyped.partitions); } + + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java index 524a6d490a7..86f9035d463 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/local/URITableLocationKey.java @@ -25,6 +25,8 @@ */ public class URITableLocationKey extends PartitionedTableLocationKey { + private static final String IMPLEMENTATION_NAME = URITableLocationKey.class.getSimpleName(); + protected final URI uri; private final int order; @@ -119,4 +121,9 @@ public boolean equals(@Nullable final Object other) { final URITableLocationKey otherTyped = (URITableLocationKey) other; return uri.equals(otherTyped.uri) && partitions.equals(otherTyped.partitions); } + + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java index 0ae291965e0..55ebb48429a 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/SimpleTableLocationKey.java @@ -15,10 +15,17 @@ */ public final class SimpleTableLocationKey extends PartitionedTableLocationKey { + private static final String IMPLEMENTATION_NAME = SimpleTableLocationKey.class.getSimpleName(); + public SimpleTableLocationKey(@Nullable final Map> partitions) { super(partitions); } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public LogOutput append(LogOutput logOutput) { return logOutput.append(getImplementationName()).append("[partitions=") diff --git a/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java b/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java index 042af9742a4..e356d0ecb92 100644 --- a/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java +++ b/extensions/iceberg/src/main/java/io/deephaven/iceberg/location/IcebergTableParquetLocationKey.java @@ -16,6 +16,7 @@ * {@link TableLocationKey} implementation for use with data stored in Iceberg tables in the parquet format. */ public class IcebergTableParquetLocationKey extends ParquetTableLocationKey implements IcebergTableLocationKey { + private static final String IMPLEMENTATION_NAME = IcebergTableParquetLocationKey.class.getSimpleName(); private final ParquetInstructions readInstructions; @@ -38,6 +39,11 @@ public IcebergTableParquetLocationKey( this.readInstructions = readInstructions; } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public ParquetInstructions readInstructions() { return readInstructions; diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java index b39fc9dfa3e..4ddebb33685 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetColumnLocation.java @@ -51,6 +51,8 @@ final class ParquetColumnLocation extends AbstractColumnLocation { + private static final String IMPLEMENTATION_NAME = ParquetColumnLocation.class.getSimpleName(); + private static final int INITIAL_PAGE_CACHE_SIZE = Configuration.getInstance() .getIntegerForClassWithDefault(ParquetColumnLocation.class, "initialPageCacheSize", 128); private static final int MAX_PAGE_CACHE_SIZE = Configuration.getInstance() @@ -105,6 +107,11 @@ private PageCache ensurePageCache() { // AbstractColumnLocation implementation // ----------------------------------------------------------------------------------------------------------------- + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public boolean exists() { // If we see a null columnChunkReaders array, either we don't exist or we are guaranteed to diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java index fc19c699d55..b782c8488c6 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocation.java @@ -54,6 +54,8 @@ public class ParquetTableLocation extends AbstractTableLocation { + private static final String IMPLEMENTATION_NAME = ParquetColumnLocation.class.getSimpleName(); + private final ParquetInstructions readInstructions; private final ParquetFileReader parquetFileReader; private final int[] rowGroupIndices; @@ -126,6 +128,11 @@ public ParquetTableLocation(@NotNull final TableKey tableKey, } } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + @Override public void refresh() {} diff --git a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java index 820fa364a10..cafff0a3210 100644 --- a/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java +++ b/extensions/parquet/table/src/main/java/io/deephaven/parquet/table/location/ParquetTableLocationKey.java @@ -31,6 +31,8 @@ */ public class ParquetTableLocationKey extends URITableLocationKey { + private static final String IMPLEMENTATION_NAME = ParquetTableLocationKey.class.getSimpleName(); + private ParquetFileReader fileReader; private ParquetMetadata metadata; private int[] rowGroupIndices; @@ -84,6 +86,11 @@ private static URI validateParquetFile(@NotNull final URI parquetFileUri) { return parquetFileUri; } + @Override + public String getImplementationName() { + return IMPLEMENTATION_NAME; + } + /** * Get a previously-{@link #setFileReader(ParquetFileReader) set} or on-demand created {@link ParquetFileReader} for * this location key's {@code file}. From 5afd7d30799b9ff1c521436a0a93d2b01795e5b9 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Thu, 29 Aug 2024 15:04:00 -0700 Subject: [PATCH 09/18] Spotless --- .../engine/table/impl/locations/TableDataService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index fea03e2f216..bdd9e629dde 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,8 +21,9 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does not - * compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. + * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for + * {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does + * not compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup From 3677e8e91ff9b645ac7bd90a48b0643c4533f2db Mon Sep 17 00:00:00 2001 From: arman-ddl <122062464+arman-ddl@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:17:53 -0700 Subject: [PATCH 10/18] Apply suggestions from code review Per Darin Co-authored-by: Darin Petty --- .../engine/table/impl/locations/TableDataService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index bdd9e629dde..38f4cf69bf5 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,14 +21,14 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the raw {@link TableLocationProvider} from this service that will provide the {@link TableLocation} for - * {@code tableKey} and {@code tableLocationKey} if the location may exist. A raw {@link TableLocationProvider} does + * Request the raw {@link TableLocationProvider} from this service that provides the {@link TableLocation} for + * {@code tableKey} and {@code tableLocationKey} if the location exists. A raw {@link TableLocationProvider} does * not compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup - * @return A raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or - * {@code null} if either key is not present + * @return The raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or + * {@code null} the table location is not present * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method. * @throws TableDataException if the TableLocationKey is provided by more than one TableLocationProvider */ From fb49b99d813bc80c94bba50510c7c1972e597a3d Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 11:23:15 -0700 Subject: [PATCH 11/18] Fix suggestion typo --- .../deephaven/engine/table/impl/locations/TableDataService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index 38f4cf69bf5..a50b635b98c 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -28,7 +28,7 @@ public interface TableDataService { * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup * @return The raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or - * {@code null} the table location is not present + * {@code null} if the table location is not present * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method. * @throws TableDataException if the TableLocationKey is provided by more than one TableLocationProvider */ From 3d05bec69ce6568c399fa798decd1090066a1d20 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 11:28:30 -0700 Subject: [PATCH 12/18] Add 'final's --- .../table/impl/locations/impl/CompositeTableDataService.java | 4 ++-- .../table/impl/locations/impl/FilteredTableDataService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index 2833e3ad498..f0f0a931d31 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -55,8 +55,8 @@ public CompositeTableDataService(@NotNull String name, @NotNull final ServiceSel @Override @Nullable - public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, - @NotNull TableLocationKey tableLocationKey) { + public TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, + @NotNull final TableLocationKey tableLocationKey) { final TableDataService[] services = serviceSelector.call(tableKey); if (services == null || services.length == 0) { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java index 00afbee24b0..21c03635091 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/FilteredTableDataService.java @@ -49,8 +49,8 @@ public FilteredTableDataService(@NotNull final TableDataService serviceToFilter, @Override @Nullable - public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, - @NotNull TableLocationKey tableLocationKey) { + public TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, + @NotNull final TableLocationKey tableLocationKey) { if (!locationKeyFilter.accept(tableLocationKey)) { return null; } From 3ea93dccafaeb0a6b9f692d7d3627686894b9fbd Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 11:30:53 -0700 Subject: [PATCH 13/18] Add 'final's (cont'd) --- .../engine/table/impl/locations/TableDataService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index a50b635b98c..8cc863697ff 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -33,8 +33,8 @@ public interface TableDataService { * @throws TableDataException if the TableLocationKey is provided by more than one TableLocationProvider */ @Nullable - default TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, - @NotNull TableLocationKey tableLocationKey) { + default TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, + @NotNull final TableLocationKey tableLocationKey) { return getTableLocationProvider(tableKey); } From 916cf21adc9c1f752dd048398ed564f6c14b0a51 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 11:52:34 -0700 Subject: [PATCH 14/18] Polish javadoc --- .../engine/table/impl/locations/TableDataService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index 8cc863697ff..045c7bb1ef8 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -22,15 +22,15 @@ public interface TableDataService { /** * Request the raw {@link TableLocationProvider} from this service that provides the {@link TableLocation} for - * {@code tableKey} and {@code tableLocationKey} if the location exists. A raw {@link TableLocationProvider} does - * not compose multiple {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. + * {@code tableKey} and {@code tableLocationKey}. A raw {@link TableLocationProvider} does not compose multiple + * {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup - * @return The raw {@link TableLocationProvider} for the specified {@link TableKey} and {@link TableLocationKey}, or - * {@code null} if the table location is not present + * @return The raw {@link TableLocationProvider} that provides the {@link TableLocation} for {@code tableKey} and + * {@code tableLocationKey}, or {@code null} if there none * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method. - * @throws TableDataException if the TableLocationKey is provided by more than one TableLocationProvider + * @throws TableDataException If tableLocationKey is provided by more than one TableLocationProvider */ @Nullable default TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, From 5ca845e0e6ee6821683d90ea23f2f70a74e8b15e Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 12:24:52 -0700 Subject: [PATCH 15/18] Polish javadoc --- .../engine/table/impl/locations/TableDataService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index 045c7bb1ef8..a994342a839 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -28,9 +28,10 @@ public interface TableDataService { * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup * @return The raw {@link TableLocationProvider} that provides the {@link TableLocation} for {@code tableKey} and - * {@code tableLocationKey}, or {@code null} if there none - * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method. - * @throws TableDataException If tableLocationKey is provided by more than one TableLocationProvider + * {@code tableLocationKey}, or {@code null} if there is none + * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method to provide a raw + * {@link TableLocationProvider}. + * @throws TableDataException If tableLocationKey is provided by more than one {@link TableLocationProvider} */ @Nullable default TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, From f8ce47ebaab65f2249c9d05f0b8c54f77d3f7fde Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Tue, 3 Sep 2024 12:33:57 -0700 Subject: [PATCH 16/18] Polish javadoc --- .../engine/table/impl/locations/TableDataService.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index a994342a839..c41c43a57de 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,17 +21,18 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the raw {@link TableLocationProvider} from this service that provides the {@link TableLocation} for - * {@code tableKey} and {@code tableLocationKey}. A raw {@link TableLocationProvider} does not compose multiple + * Request the single raw {@link TableLocationProvider} from this service that provides the {@link TableLocation} + * for {@code tableKey} and {@code tableLocationKey}. A raw {@link TableLocationProvider} does not compose multiple * {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup * @return The raw {@link TableLocationProvider} that provides the {@link TableLocation} for {@code tableKey} and * {@code tableLocationKey}, or {@code null} if there is none - * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method to provide a raw - * {@link TableLocationProvider}. - * @throws TableDataException If tableLocationKey is provided by more than one {@link TableLocationProvider} + * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method to provide a single raw + * {@link TableLocationProvider} or throw a {@link TableDataException} if there is ambiguity. + * @throws TableDataException If the {@link TableLocation} is provided by more than one + * {@link TableLocationProvider} */ @Nullable default TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, From 52b7ee44fe077c637884e9ed085834d38e3aaa59 Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Wed, 4 Sep 2024 16:06:41 -0700 Subject: [PATCH 17/18] Remove TDS default; add ATDS impl --- .../table/impl/locations/TableDataService.java | 18 +++++++----------- .../impl/AbstractTableDataService.java | 13 +++++++++++++ .../impl/CompositeTableDataService.java | 15 +++++++-------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java index c41c43a57de..8d3f9638d6d 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/TableDataService.java @@ -21,24 +21,20 @@ public interface TableDataService { TableLocationProvider getTableLocationProvider(@NotNull TableKey tableKey); /** - * Request the single raw {@link TableLocationProvider} from this service that provides the {@link TableLocation} - * for {@code tableKey} and {@code tableLocationKey}. A raw {@link TableLocationProvider} does not compose multiple + * Request the single raw {@link TableLocationProvider} from this service that has the {@link TableLocation} for + * {@code tableKey} and {@code tableLocationKey}. A raw {@link TableLocationProvider} does not compose multiple * {@link TableLocationProvider TableLocationProviders} or delegate to other implementations. * * @param tableKey The {@link TableKey} to lookup * @param tableLocationKey The {@link TableLocationKey} to lookup - * @return The raw {@link TableLocationProvider} that provides the {@link TableLocation} for {@code tableKey} and + * @return The raw {@link TableLocationProvider} that has the {@link TableLocation} for {@code tableKey} and * {@code tableLocationKey}, or {@code null} if there is none - * @implSpec Non-raw {@link TableDataService TableDataServices} must implement this method to provide a single raw - * {@link TableLocationProvider} or throw a {@link TableDataException} if there is ambiguity. - * @throws TableDataException If the {@link TableLocation} is provided by more than one - * {@link TableLocationProvider} + * @throws TableDataException If more than one {@link TableLocationProvider} has the {@link TableLocation} + * */ @Nullable - default TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, - @NotNull final TableLocationKey tableLocationKey) { - return getTableLocationProvider(tableKey); - } + TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey tableKey, + @NotNull final TableLocationKey tableLocationKey); /** * Forget all state for subsequent requests for all tables. diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableDataService.java index 3be464123c4..a7d7ed2dd39 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/AbstractTableDataService.java @@ -5,6 +5,7 @@ import io.deephaven.engine.table.impl.locations.TableDataService; import io.deephaven.engine.table.impl.locations.TableKey; +import io.deephaven.engine.table.impl.locations.TableLocationKey; import io.deephaven.engine.table.impl.locations.TableLocationProvider; import io.deephaven.hash.KeyedObjectHashMap; import io.deephaven.hash.KeyedObjectKey; @@ -41,6 +42,18 @@ public final TableLocationProvider getTableLocationProvider(@NotNull final Table return tableLocationProviders.putIfAbsent(tableKey, this::makeTableLocationProvider); } + @Override + @Nullable + public TableLocationProvider getRawTableLocationProvider(@NotNull TableKey tableKey, + @NotNull TableLocationKey tableLocationKey) { + final TableLocationProvider tableLocationProvider = tableLocationProviders.get(tableKey); + if (tableLocationProvider == null || !tableLocationProvider.hasTableLocationKey(tableLocationKey)) { + return null; + } + + return tableLocationProvider; + } + @Override public void reset() { tableLocationProviders.clear(); diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java index f0f0a931d31..d5ad0e1faf0 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/locations/impl/CompositeTableDataService.java @@ -70,15 +70,14 @@ public TableLocationProvider getRawTableLocationProvider(@NotNull final TableKey continue; } - if (tlpCandidate.hasTableLocationKey(tableLocationKey)) { - if (tlp != null) { - throw new TableDataException( - "TableDataService elements " + tlpCandidate.getName() + " and " + tlp.getName() - + " both contain " + tableLocationKey + ". Full TableDataService configuration:\n" - + Formatter.formatTableDataService(CompositeTableDataService.this.toString())); - } - tlp = tlpCandidate; + if (tlp != null) { + throw new TableDataException( + "TableDataService elements " + tlpCandidate.getName() + " and " + tlp.getName() + + " both contain " + tableLocationKey + ". Full TableDataService configuration:\n" + + Formatter.formatTableDataService(CompositeTableDataService.this.toString())); } + + tlp = tlpCandidate; } return tlp; From 4649a1a74ae433e9726cc679d7b0ba3fd674b26a Mon Sep 17 00:00:00 2001 From: Arman Farhangi Date: Thu, 5 Sep 2024 09:36:35 -0700 Subject: [PATCH 18/18] Add unit test --- .../engine/table/impl/DummyTableLocation.java | 131 ++++++++++++++++++ .../table/impl/TestPartitioningColumns.java | 113 --------------- .../locations/impl/TestTableDataService.java | 96 +++++++++++++ 3 files changed, 227 insertions(+), 113 deletions(-) create mode 100644 engine/table/src/test/java/io/deephaven/engine/table/impl/DummyTableLocation.java create mode 100644 engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/TestTableDataService.java diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/DummyTableLocation.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/DummyTableLocation.java new file mode 100644 index 00000000000..752c74b9414 --- /dev/null +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/DummyTableLocation.java @@ -0,0 +1,131 @@ +// +// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending +// +package io.deephaven.engine.table.impl; + +import io.deephaven.api.SortColumn; +import io.deephaven.chunk.attributes.Values; +import io.deephaven.engine.table.BasicDataIndex; +import io.deephaven.engine.table.ColumnDefinition; +import io.deephaven.engine.table.impl.locations.ColumnLocation; +import io.deephaven.engine.table.impl.locations.TableKey; +import io.deephaven.engine.table.impl.locations.TableLocation; +import io.deephaven.engine.table.impl.locations.TableLocationKey; +import io.deephaven.engine.table.impl.locations.impl.AbstractTableLocation; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionByte; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionChar; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionDouble; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionFloat; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionInt; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionLong; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionObject; +import io.deephaven.engine.table.impl.sources.regioned.ColumnRegionShort; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public final class DummyTableLocation extends AbstractTableLocation { + + public DummyTableLocation(@NotNull final TableKey tableKey, + @NotNull final TableLocationKey tableLocationKey) { + super(tableKey, tableLocationKey, false); + } + + @Override + public void refresh() {} + + @Override + public @NotNull List getSortedColumns() { + return List.of(); + } + + @Override + @NotNull + public List getDataIndexColumns() { + return List.of(); + } + + @Override + public boolean hasDataIndex(@NotNull final String... columns) { + return false; + } + + @NotNull + @Override + protected ColumnLocation makeColumnLocation(@NotNull final String name) { + return new ColumnLocation() { + @NotNull + @Override + public TableLocation getTableLocation() { + return DummyTableLocation.this; + } + + @NotNull + @Override + public String getName() { + return name; + } + + @Override + public boolean exists() { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionChar makeColumnRegionChar( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionByte makeColumnRegionByte( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionShort makeColumnRegionShort( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionInt makeColumnRegionInt( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionLong makeColumnRegionLong( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionFloat makeColumnRegionFloat( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionDouble makeColumnRegionDouble( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + @Override + public ColumnRegionObject makeColumnRegionObject( + @NotNull final ColumnDefinition columnDefinition) { + throw new UnsupportedOperationException(); + } + + }; + } + + @Override + @Nullable + public BasicDataIndex loadDataIndex(@NotNull final String... columns) { + throw new UnsupportedOperationException(); + } +} diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/TestPartitioningColumns.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/TestPartitioningColumns.java index adb04b08fa5..63cc10f6a7d 100644 --- a/engine/table/src/test/java/io/deephaven/engine/table/impl/TestPartitioningColumns.java +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/TestPartitioningColumns.java @@ -3,10 +3,8 @@ // package io.deephaven.engine.table.impl; -import io.deephaven.api.SortColumn; import io.deephaven.api.filter.Filter; import io.deephaven.base.verify.Assert; -import io.deephaven.chunk.attributes.Values; import io.deephaven.engine.primitive.iterator.CloseableIterator; import io.deephaven.engine.rowset.RowSet; import io.deephaven.engine.table.*; @@ -17,17 +15,11 @@ import io.deephaven.engine.testutil.TstUtils; import io.deephaven.engine.testutil.junit4.EngineCleanup; import io.deephaven.time.DateTimeUtils; -import io.deephaven.engine.table.impl.locations.ColumnLocation; -import io.deephaven.engine.table.impl.locations.TableKey; -import io.deephaven.engine.table.impl.locations.TableLocation; -import io.deephaven.engine.table.impl.locations.TableLocationKey; import io.deephaven.engine.table.impl.locations.impl.*; import io.deephaven.engine.table.impl.select.MatchFilter; import io.deephaven.engine.table.impl.select.WhereFilter; import io.deephaven.engine.table.impl.sources.regioned.*; import io.deephaven.engine.rowset.RowSetFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.junit.Rule; import org.junit.Test; @@ -135,109 +127,4 @@ public void testEverything() { TstUtils.assertTableEquals(expected.selectDistinct(), result.selectDistinct()); } - - private static final class DummyTableLocation extends AbstractTableLocation { - - private DummyTableLocation(@NotNull final TableKey tableKey, - @NotNull final TableLocationKey tableLocationKey) { - super(tableKey, tableLocationKey, false); - } - - @Override - public void refresh() {} - - @Override - public @NotNull List getSortedColumns() { - return List.of(); - } - - @Override - @NotNull - public List getDataIndexColumns() { - return List.of(); - } - - @Override - public boolean hasDataIndex(@NotNull final String... columns) { - return false; - } - - @NotNull - @Override - protected ColumnLocation makeColumnLocation(@NotNull final String name) { - return new ColumnLocation() { - @NotNull - @Override - public TableLocation getTableLocation() { - return DummyTableLocation.this; - } - - @NotNull - @Override - public String getName() { - return name; - } - - @Override - public boolean exists() { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionChar makeColumnRegionChar( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionByte makeColumnRegionByte( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionShort makeColumnRegionShort( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionInt makeColumnRegionInt( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionLong makeColumnRegionLong( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionFloat makeColumnRegionFloat( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionDouble makeColumnRegionDouble( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - @Override - public ColumnRegionObject makeColumnRegionObject( - @NotNull final ColumnDefinition columnDefinition) { - throw new UnsupportedOperationException(); - } - - }; - } - - @Override - @Nullable - public BasicDataIndex loadDataIndex(@NotNull final String... columns) { - throw new UnsupportedOperationException(); - } - } } diff --git a/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/TestTableDataService.java b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/TestTableDataService.java new file mode 100644 index 00000000000..1687a46d5ed --- /dev/null +++ b/engine/table/src/test/java/io/deephaven/engine/table/impl/locations/impl/TestTableDataService.java @@ -0,0 +1,96 @@ +// +// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending +// +package io.deephaven.engine.table.impl.locations.impl; + +import io.deephaven.engine.table.impl.DummyTableLocation; +import io.deephaven.engine.table.impl.locations.TableDataException; +import io.deephaven.engine.table.impl.locations.TableDataService; +import io.deephaven.engine.table.impl.locations.TableKey; +import io.deephaven.engine.table.impl.locations.TableLocation; +import io.deephaven.engine.table.impl.locations.TableLocationKey; +import io.deephaven.engine.table.impl.locations.TableLocationProvider; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +public class TestTableDataService { + @Test + public void testGetRawTableDataService() { + final Map> partitions1 = new HashMap<>(); + partitions1.put("Part", "A"); + final Map> partitions2 = new HashMap<>(); + partitions2.put("Part", "B"); + final Map> partitions3 = new HashMap<>(); + partitions3.put("Part", "C"); + + TableLocationKey tlk1 = new SimpleTableLocationKey(partitions1); + TableLocationKey tlk2 = new SimpleTableLocationKey(partitions2); + TableLocationKey tlk3 = new SimpleTableLocationKey(partitions3); + + // No table location overlap + final CompositeTableDataService ctds1 = + new CompositeTableDataService("ctds1", new DummyServiceSelector(tlk1, tlk2)); + Assert.assertNotNull(ctds1.getRawTableLocationProvider(StandaloneTableKey.getInstance(), tlk1)); + Assert.assertNull(ctds1.getRawTableLocationProvider(StandaloneTableKey.getInstance(), tlk3)); + + // Table location overlap + final CompositeTableDataService ctds2 = + new CompositeTableDataService("ctds2", new DummyServiceSelector(tlk1, tlk1)); + Assert.assertThrows(TableDataException.class, + () -> ctds2.getRawTableLocationProvider(StandaloneTableKey.getInstance(), tlk1)); + Assert.assertNull(ctds2.getRawTableLocationProvider(StandaloneTableKey.getInstance(), tlk3)); + } + + private static class DummyTableDataService extends AbstractTableDataService { + final TableLocation tableLocation; + + private DummyTableDataService(@NotNull final String name, @NotNull final TableLocation tableLocation) { + super(name); + this.tableLocation = tableLocation; + } + + @Override + @NotNull + protected TableLocationProvider makeTableLocationProvider(@NotNull TableKey tableKey) { + return new SingleTableLocationProvider(tableLocation); + } + } + + private static class DummyServiceSelector implements CompositeTableDataService.ServiceSelector { + final TableDataService[] tableDataServices; + + private DummyServiceSelector(final TableLocationKey tlk1, final TableLocationKey tlk2) { + final FilteredTableDataService.LocationKeyFilter dummyFilter = (tlk) -> true; + tableDataServices = new TableDataService[] { + new FilteredTableDataService(new DummyTableDataService("dummyTds1", + new DummyTableLocation(StandaloneTableKey.getInstance(), tlk1)), dummyFilter), + new FilteredTableDataService(new DummyTableDataService("dummyTds2", + new DummyTableLocation(StandaloneTableKey.getInstance(), tlk2)), dummyFilter) + }; + // Init table locations + tableDataServices[0].getTableLocationProvider(StandaloneTableKey.getInstance()) + .getTableLocationIfPresent(tlk1); + tableDataServices[1].getTableLocationProvider(StandaloneTableKey.getInstance()) + .getTableLocationIfPresent(tlk2); + } + + @Override + public TableDataService[] call(@NotNull TableKey tableKey) { + return tableDataServices; + } + + @Override + public void resetServices() { + throw new UnsupportedOperationException(); + } + + @Override + public void resetServices(@NotNull TableKey key) { + throw new UnsupportedOperationException(); + } + } +}