Remove FalseVectorMatcher, TrueVectorMatcher in favor of BooleanVectorValueMatcher. (#10757)

This commit is contained in:
Gian Merlino 2021-01-14 18:28:25 -08:00 committed by GitHub
parent e52db19823
commit 2bbf89db81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 106 deletions

View File

@ -1,50 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.query.filter.vector;
import org.apache.druid.segment.vector.VectorSizeInspector;
public class FalseVectorMatcher implements VectorValueMatcher
{
private final VectorSizeInspector vectorSizeInspector;
public FalseVectorMatcher(VectorSizeInspector vectorSizeInspector)
{
this.vectorSizeInspector = vectorSizeInspector;
}
@Override
public ReadableVectorMatch match(ReadableVectorMatch mask)
{
return VectorMatch.allFalse();
}
@Override
public int getMaxVectorSize()
{
return vectorSizeInspector.getMaxVectorSize();
}
@Override
public int getCurrentVectorSize()
{
return vectorSizeInspector.getCurrentVectorSize();
}
}

View File

@ -1,51 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.query.filter.vector;
import org.apache.druid.segment.vector.VectorSizeInspector;
public class TrueVectorMatcher implements VectorValueMatcher
{
private final VectorSizeInspector vectorSizeInspector;
public TrueVectorMatcher(VectorSizeInspector vectorSizeInspector)
{
this.vectorSizeInspector = vectorSizeInspector;
}
@Override
public ReadableVectorMatch match(ReadableVectorMatch mask)
{
// The given mask is all true for its valid selections.
return mask;
}
@Override
public int getMaxVectorSize()
{
return vectorSizeInspector.getMaxVectorSize();
}
@Override
public int getCurrentVectorSize()
{
return vectorSizeInspector.getCurrentVectorSize();
}
}

View File

@ -23,7 +23,7 @@ import org.apache.druid.query.BitmapResultFactory;
import org.apache.druid.query.filter.BitmapIndexSelector; import org.apache.druid.query.filter.BitmapIndexSelector;
import org.apache.druid.query.filter.Filter; import org.apache.druid.query.filter.Filter;
import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.query.filter.ValueMatcher;
import org.apache.druid.query.filter.vector.FalseVectorMatcher; import org.apache.druid.query.filter.vector.BooleanVectorValueMatcher;
import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.query.filter.vector.VectorValueMatcher;
import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelector;
import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.ColumnSelectorFactory;
@ -67,7 +67,7 @@ public class FalseFilter implements Filter
@Override @Override
public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory)
{ {
return new FalseVectorMatcher(factory.getReadableVectorInspector()); return BooleanVectorValueMatcher.of(factory.getReadableVectorInspector(), false);
} }
@Override @Override

View File

@ -23,7 +23,7 @@ import org.apache.druid.query.BitmapResultFactory;
import org.apache.druid.query.filter.BitmapIndexSelector; import org.apache.druid.query.filter.BitmapIndexSelector;
import org.apache.druid.query.filter.Filter; import org.apache.druid.query.filter.Filter;
import org.apache.druid.query.filter.ValueMatcher; import org.apache.druid.query.filter.ValueMatcher;
import org.apache.druid.query.filter.vector.TrueVectorMatcher; import org.apache.druid.query.filter.vector.BooleanVectorValueMatcher;
import org.apache.druid.query.filter.vector.VectorValueMatcher; import org.apache.druid.query.filter.vector.VectorValueMatcher;
import org.apache.druid.segment.ColumnSelector; import org.apache.druid.segment.ColumnSelector;
import org.apache.druid.segment.ColumnSelectorFactory; import org.apache.druid.segment.ColumnSelectorFactory;
@ -34,6 +34,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
*
*/ */
public class TrueFilter implements Filter public class TrueFilter implements Filter
{ {
@ -57,13 +58,13 @@ public class TrueFilter implements Filter
@Override @Override
public ValueMatcher makeMatcher(ColumnSelectorFactory factory) public ValueMatcher makeMatcher(ColumnSelectorFactory factory)
{ {
return TrueValueMatcher.instance(); return BooleanValueMatcher.of(true);
} }
@Override @Override
public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory) public VectorValueMatcher makeVectorMatcher(VectorColumnSelectorFactory factory)
{ {
return new TrueVectorMatcher(factory.getReadableVectorInspector()); return BooleanVectorValueMatcher.of(factory.getReadableVectorInspector(), true);
} }
@Override @Override