Skip to content

Commit

Permalink
Fix Merge Conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
nbauernfeind committed Mar 21, 2024
1 parent ef053f1 commit 9527dec
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,8 @@ public Table selectDistinctInternal(Collection<? extends Selectable> columns) {

final Set<String> newColumns = new HashSet<>();
for (final SelectColumn selectColumn : selectColumns) {
<<<<<<< HEAD
if (!((PartitionAwareSourceTable) table).isValidAgainstColumnPartitionTable(
selectColumn.getColumns(), selectColumn.getColumnArrays(), newColumns)) {
=======
try {
selectColumn.initDef(getDefinition().getColumnNameMap());
} catch (Exception e) {
return null;
}
if (!((PartitionAwareSourceTable) table).isValidAgainstColumnPartitionTable(
selectColumn.getColumns(), selectColumn.getColumnArrays())) {
>>>>>>> upstream/main
return null;
}
newColumns.add(selectColumn.getName());
Expand Down Expand Up @@ -268,22 +258,13 @@ private Table whereImpl(final WhereFilter[] whereFilters) {
return prepareReturnThis();
}

<<<<<<< HEAD
final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor = QueryCompilerRequestProcessor.batch();
for (WhereFilter whereFilter : whereFilters) {
whereFilter.init(definition, compilationProcessor);
List<String> columns = whereFilter.getColumns();
if (whereFilter instanceof ReindexingFilter) {
otherFilters.add(whereFilter);
} else if (isValidAgainstColumnPartitionTable(columns, whereFilter.getColumnArrays())) {
=======
final List<WhereFilter> partitionFilters = new ArrayList<>();
final List<WhereFilter> deferredFilters = new ArrayList<>();
for (WhereFilter whereFilter : whereFilters) {
whereFilter.init(definition);
whereFilter.init(definition, compilationProcessor);
if (!(whereFilter instanceof ReindexingFilter)
&& isValidAgainstColumnPartitionTable(whereFilter.getColumns(), whereFilter.getColumnArrays())) {
>>>>>>> upstream/main
partitionFilters.add(whereFilter);
} else {
deferredFilters.add(whereFilter);
Expand All @@ -306,19 +287,13 @@ && isValidAgainstColumnPartitionTable(whereFilter.getColumns(), whereFilter.getC
@Override
public final Table selectDistinct(@NotNull final Collection<? extends Selectable> columns) {
final List<SelectColumn> selectColumns = Arrays.asList(SelectColumn.from(columns));
<<<<<<< HEAD
SelectAndViewAnalyzer.initializeSelectColumns(
definition.getColumnNameMap(), selectColumns.toArray(SelectColumn[]::new));

final Set<String> newColumns = new HashSet<>();
for (SelectColumn selectColumn : selectColumns) {
for (final SelectColumn selectColumn : selectColumns) {
if (!isValidAgainstColumnPartitionTable(
selectColumn.getColumns(), selectColumn.getColumnArrays(), newColumns)) {
=======
for (final SelectColumn selectColumn : selectColumns) {
selectColumn.initDef(definition.getColumnNameMap());
if (!isValidAgainstColumnPartitionTable(selectColumn.getColumns(), selectColumn.getColumnArrays())) {
>>>>>>> upstream/main
// Be sure to invoke the super-class version of this method, rather than the array-based one that
// delegates to this method.
return super.selectDistinct(selectColumns);
Expand All @@ -336,7 +311,6 @@ public final Table selectDistinct(@NotNull final Collection<? extends Selectable
private boolean isValidAgainstColumnPartitionTable(
@NotNull final Collection<String> columnNames,
@NotNull final Collection<String> columnArrayNames) {
<<<<<<< HEAD
return isValidAgainstColumnPartitionTable(columnNames, columnArrayNames, Collections.emptySet());
}

Expand All @@ -350,11 +324,4 @@ private boolean isValidAgainstColumnPartitionTable(
return columnNames.stream().allMatch(
columnName -> partitioningColumnDefinitions.containsKey(columnName) || newColumns.contains(columnName));
}
=======
if (!columnArrayNames.isEmpty()) {
return false;
}
return columnNames.stream().allMatch(partitioningColumnDefinitions::containsKey);
}
>>>>>>> upstream/main
}
Original file line number Diff line number Diff line change
Expand Up @@ -1167,13 +1167,18 @@ private void initializeAndPrioritizeFilters(@NotNull final WhereFilter... filter
final DataIndexer dataIndexer = DataIndexer.existingOf(rowSet);
final int numFilters = filters.length;
final BitSet priorityFilterIndexes = new BitSet(numFilters);

final QueryCompilerRequestProcessor.BatchProcessor compilationProcesor = QueryCompilerRequestProcessor.batch();
// Initialize our filters immediately so we can examine the columns they use. Note that filter
// initialization is safe to invoke repeatedly.
for (final WhereFilter filter : filters) {
filter.init(getDefinition(), compilationProcesor);
}
compilationProcesor.compile();

for (int fi = 0; fi < numFilters; ++fi) {
final WhereFilter filter = filters[fi];

// Initialize our filters immediately so we can examine the columns they use. Note that filter
// initialization is safe to invoke repeatedly.
filter.init(getDefinition());

// Simple filters against indexed columns get priority
if (dataIndexer != null
&& !(filter instanceof ReindexingFilter)
Expand Down Expand Up @@ -1246,37 +1251,20 @@ private QueryTable whereInternal(final WhereFilter... filters) {
return result;
}

<<<<<<< HEAD
List<WhereFilter> selectFilters = new LinkedList<>();
List<io.deephaven.base.Pair<String, Map<Long, List<MatchPair>>>> shiftColPairs = new LinkedList<>();
final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor =
QueryCompilerRequestProcessor.batch();
final List<WhereFilter> whereFilters = new LinkedList<>();
final List<io.deephaven.base.Pair<String, Map<Long, List<MatchPair>>>> shiftColPairs =
new LinkedList<>();
for (final WhereFilter filter : filters) {
filter.init(getDefinition(), compilationProcessor);
if (filter instanceof AbstractConditionFilter
&& ((AbstractConditionFilter) filter).hasConstantArrayAccess()) {
shiftColPairs.add(((AbstractConditionFilter) filter).getFormulaShiftColPair());
} else {
selectFilters.add(filter);
=======
{
final List<WhereFilter> whereFilters = new LinkedList<>();
final List<io.deephaven.base.Pair<String, Map<Long, List<MatchPair>>>> shiftColPairs =
new LinkedList<>();
for (final WhereFilter filter : filters) {
if (filter instanceof AbstractConditionFilter
&& ((AbstractConditionFilter) filter).hasConstantArrayAccess()) {
shiftColPairs.add(((AbstractConditionFilter) filter).getFormulaShiftColPair());
} else {
whereFilters.add(filter);
}
}
if (!shiftColPairs.isEmpty()) {
return (QueryTable) ShiftedColumnsFactory.where(this, shiftColPairs, whereFilters);
>>>>>>> upstream/main
whereFilters.add(filter);
}
}
compilationProcessor.compile();
if (!shiftColPairs.isEmpty()) {
return (QueryTable) ShiftedColumnsFactory.where(this, shiftColPairs, whereFilters);
}

return memoizeResult(MemoizedOperationKey.filter(filters), () -> {
try (final SafeCloseable ignored = Arrays.stream(filters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,8 @@ private Table viewInternal(Collection<? extends Selectable> selectables, boolean

final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor = QueryCompilerRequestProcessor.batch();
for (final SelectColumn selectColumn : columns) {
<<<<<<< HEAD
List<String> usedColumnNames = selectColumn.initDef(allColumns, compilationProcessor);
=======
final List<String> usedColumnNames = new ArrayList<>(selectColumn.initDef(allColumns));
>>>>>>> upstream/main
final List<String> usedColumnNames = new ArrayList<>(
selectColumn.initDef(allColumns, compilationProcessor));
usedColumnNames.addAll(selectColumn.getColumnArrays());
resultColumnsInternal.addAll(usedColumnNames.stream()
.filter(usedColumnName -> !resultColumnsExternal.containsKey(usedColumnName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public class WouldMatchOperation implements QueryTable.MemoizableOperation<Query
* Just a little helper to keep column stuff together.
*/
private static class ColumnHolder {
<<<<<<< HEAD
final WouldMatchPair wouldMatchPair;
IndexWrapperColumnSource column;
=======
>>>>>>> upstream/main

private final WouldMatchPair wouldMatchPair;
private final WhereFilter filter;
Expand Down Expand Up @@ -98,9 +93,12 @@ public String getLogPrefix() {

@Override
public SafeCloseable beginOperation(@NotNull final QueryTable parent) {
final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor = QueryCompilerRequestProcessor.batch();
Arrays.stream(whereFilters).forEach(filter -> filter.init(parent.getDefinition(), compilationProcessor));
compilationProcessor.compile();

return Arrays.stream(whereFilters)
.map((final WhereFilter filter) -> {
filter.init(parent.getDefinition());
// Ensure we gather the correct dependencies when building a snapshot control.
return filter.beginOperation(parent);
}).collect(SafeCloseableList.COLLECTOR);
Expand All @@ -122,22 +120,9 @@ public Result<QueryTable> initialize(boolean usePrev, long beforeClock) {
try (final SafeCloseableList closer = new SafeCloseableList()) {
final RowSet fullRowSet = usePrev ? closer.add(parent.getRowSet().copyPrev()) : parent.getRowSet();
final Map<String, ColumnSource<?>> newColumns = new LinkedHashMap<>(parent.getColumnSourceMap());
<<<<<<< HEAD
final QueryCompilerRequestProcessor.BatchProcessor compilationProcessor =
QueryCompilerRequestProcessor.batch();
final WhereFilter[] filters = matchColumns.stream().map(ColumnHolder::getFilter)
.peek(holder -> holder.init(parent.getDefinition(), compilationProcessor))
.toArray(WhereFilter[]::new);
compilationProcessor.compile();

for (int ii = 0; ii < filters.length; ++ii) {
final ColumnHolder holder = matchColumns.get(ii);
final WhereFilter filter = filters[ii];
=======

matchColumns.forEach(holder -> {
final WhereFilter filter = holder.getFilter();
>>>>>>> upstream/main
final WritableRowSet result = filter.filter(fullRowSet, fullRowSet, parent, usePrev);
holder.column = new IndexWrapperColumnSource(
holder.getColumnName(), parent, result.toTracking(), filter);
Expand All @@ -151,7 +136,7 @@ public Result<QueryTable> initialize(boolean usePrev, long beforeClock) {
if (filter.isRefreshing()) {
anyRefreshing.setTrue();
}
}
});

resultTable = new QueryTable(parent.getRowSet(), newColumns);
transformer =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@

import io.deephaven.engine.table.Table;
import io.deephaven.engine.table.TableDefinition;
<<<<<<< HEAD
import io.deephaven.engine.table.impl.QueryCompilerRequestProcessor;
=======
import io.deephaven.engine.table.impl.BaseTable;
>>>>>>> upstream/main
import io.deephaven.engine.updategraph.NotificationQueue;
import io.deephaven.engine.liveness.LivenessArtifact;
import io.deephaven.engine.table.impl.DependencyStreamProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public List<String> initInputs(TrackingRowSet rowSet, Map<String, ? extends Colu
}

@Override
public List<String> initDef(Map<String, ColumnDefinition<?>> columnDefinitionMap) {
public List<String> initDef(@NotNull final Map<String, ColumnDefinition<?>> columnDefinitionMap) {
// noinspection unchecked
final ColumnDefinition<S> sourceColumnDefinition = (ColumnDefinition<S>) columnDefinitionMap.get(sourceName);
if (sourceColumnDefinition == null) {
Expand All @@ -106,6 +106,11 @@ public Class<?> getReturnedType() {
return long.class;
}

@Override
public Class<?> getReturnedComponentType() {
return null;
}

@Override
public List<String> getColumns() {
return List.of(sourceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,19 @@

import io.deephaven.api.literal.Literal;
import io.deephaven.base.string.cache.CompressedString;
<<<<<<< HEAD
=======
import io.deephaven.engine.context.ExecutionContext;
import io.deephaven.engine.context.QueryScope;
import io.deephaven.engine.liveness.LivenessScopeStack;
import io.deephaven.engine.rowset.RowSet;
>>>>>>> upstream/main
import io.deephaven.engine.rowset.WritableRowSet;
import io.deephaven.engine.table.ColumnDefinition;
import io.deephaven.engine.table.ColumnSource;
import io.deephaven.engine.table.DataIndex;
import io.deephaven.engine.table.Table;
import io.deephaven.engine.table.TableDefinition;
<<<<<<< HEAD
import io.deephaven.engine.table.impl.QueryCompilerRequestProcessor;
import io.deephaven.engine.table.impl.preview.DisplayWrapper;
=======
import io.deephaven.engine.table.impl.DependencyStreamProvider;
import io.deephaven.engine.table.impl.indexer.DataIndexer;
import io.deephaven.engine.table.impl.preview.DisplayWrapper;
import io.deephaven.engine.updategraph.NotificationQueue;
>>>>>>> upstream/main
import io.deephaven.time.DateTimeUtils;
import io.deephaven.util.SafeCloseable;
import io.deephaven.util.type.ArrayTypeUtils;
Expand Down

0 comments on commit 9527dec

Please sign in to comment.