This is an automated email from the ASF dual-hosted git repository.
rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 52d0eddf76 remove unused classes (#9607)
52d0eddf76 is described below
commit 52d0eddf76031ca5e3411fad5c5b101f82bffc8c
Author: Almog Gavra <[email protected]>
AuthorDate: Mon Oct 17 15:08:10 2022 -0700
remove unused classes (#9607)
---
.../processing/filter/RecordFilterConfig.java | 89 ----------------------
.../processing/filter/RecordFilterFactory.java | 60 ---------------
.../transformer/RecordTransformerFactory.java | 37 ---------
.../processing/framework/RecordFilterTest.java | 83 --------------------
.../framework/RecordTransformerTest.java | 89 ----------------------
5 files changed, 358 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterConfig.java
b/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterConfig.java
deleted file mode 100644
index eb445a1a3e..0000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterConfig.java
+++ /dev/null
@@ -1,89 +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.pinot.core.segment.processing.filter;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-
-/**
- * Config for RecordFilter
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class RecordFilterConfig {
-
- private static final RecordFilterFactory.RecordFilterType
DEFAULT_RECORD_FILTER_TYPE =
- RecordFilterFactory.RecordFilterType.NO_OP;
-
- private final RecordFilterFactory.RecordFilterType _recordFilterType;
- private final String _filterFunction;
-
- @JsonCreator
- private RecordFilterConfig(
- @JsonProperty(value = "recordFilterType", required = true)
RecordFilterFactory.RecordFilterType recordFilterType,
- @JsonProperty(value = "filterFunction") String filterFunction) {
- _recordFilterType = recordFilterType;
- _filterFunction = filterFunction;
- }
-
- /**
- * The type of RecordFilter
- */
- @JsonProperty
- public RecordFilterFactory.RecordFilterType getRecordFilterType() {
- return _recordFilterType;
- }
-
- /**
- * Filter function to use for filtering out partitions
- */
- @JsonProperty
- public String getFilterFunction() {
- return _filterFunction;
- }
-
- /**
- * Builder for a RecordFilterConfig
- */
- public static class Builder {
- private RecordFilterFactory.RecordFilterType _recordFilterType =
DEFAULT_RECORD_FILTER_TYPE;
- private String _filterFunction;
-
- public Builder setRecordFilterType(RecordFilterFactory.RecordFilterType
recordFilterType) {
- _recordFilterType = recordFilterType;
- return this;
- }
-
- public Builder setFilterFunction(String filterFunction) {
- _filterFunction = filterFunction;
- return this;
- }
-
- public RecordFilterConfig build() {
- return new RecordFilterConfig(_recordFilterType, _filterFunction);
- }
- }
-
- @Override
- public String toString() {
- return "RecordFilterConfig{" + " _recordFilterType=" + _recordFilterType +
", _filterFunction='" + _filterFunction
- + '\'' + '}';
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterFactory.java
b/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterFactory.java
deleted file mode 100644
index 3a8763d559..0000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/filter/RecordFilterFactory.java
+++ /dev/null
@@ -1,60 +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.pinot.core.segment.processing.filter;
-
-import com.google.common.base.Preconditions;
-
-
-/**
- * Factory for RecordFilter
- */
-public final class RecordFilterFactory {
-
- private RecordFilterFactory() {
- }
-
- public enum RecordFilterType {
- NO_OP,
- /**
- * Evaluates a function expression to decide if the record should be
filtered
- */
- FILTER_FUNCTION
- }
-
- /**
- * Construct a RecordFilter using the RecordFilterConfig
- */
- public static RecordFilter getRecordFilter(RecordFilterConfig config) {
-
- RecordFilter recordFilter = null;
- switch (config.getRecordFilterType()) {
- case NO_OP:
- recordFilter = new NoOpRecordFilter();
- break;
- case FILTER_FUNCTION:
- Preconditions.checkState(config.getFilterFunction() != null,
- "Must provide filterFunction for FILTER_FUNCTION record filter");
- recordFilter = new
FunctionEvaluatorRecordFilter(config.getFilterFunction());
- break;
- default:
- break;
- }
- return recordFilter;
- }
-}
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/transformer/RecordTransformerFactory.java
b/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/transformer/RecordTransformerFactory.java
deleted file mode 100644
index 4a8d1dc9d5..0000000000
---
a/pinot-core/src/main/java/org/apache/pinot/core/segment/processing/transformer/RecordTransformerFactory.java
+++ /dev/null
@@ -1,37 +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.pinot.core.segment.processing.transformer;
-
-/**
- * Factory for RecordTransformer
- */
-public final class RecordTransformerFactory {
- private RecordTransformerFactory() {
- }
-
- /**
- * Construct a RecordTransformer from the config
- */
- public static RecordTransformer getRecordTransformer(RecordTransformerConfig
recordTransformerConfig) {
- if (recordTransformerConfig.getTransformFunctionsMap() != null) {
- return new
TransformFunctionRecordTransformer(recordTransformerConfig.getTransformFunctionsMap());
- }
- return new NoOpRecordTransformer();
- }
-}
diff --git
a/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordFilterTest.java
b/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordFilterTest.java
deleted file mode 100644
index 7d638d5817..0000000000
---
a/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordFilterTest.java
+++ /dev/null
@@ -1,83 +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.pinot.core.segment.processing.framework;
-
-import
org.apache.pinot.core.segment.processing.filter.FunctionEvaluatorRecordFilter;
-import org.apache.pinot.core.segment.processing.filter.NoOpRecordFilter;
-import org.apache.pinot.core.segment.processing.filter.RecordFilter;
-import org.apache.pinot.core.segment.processing.filter.RecordFilterConfig;
-import org.apache.pinot.core.segment.processing.filter.RecordFilterFactory;
-import org.apache.pinot.spi.data.readers.GenericRow;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-
-/**
- * Tests for {@link RecordFilter}
- */
-public class RecordFilterTest {
-
- @Test
- public void getPartitionFilterTest() {
- RecordFilterConfig recordFilterConfig = new
RecordFilterConfig.Builder().build();
- RecordFilter recordFilter =
RecordFilterFactory.getRecordFilter(recordFilterConfig);
- assertEquals(recordFilter.getClass(), NoOpRecordFilter.class);
-
- recordFilterConfig =
- new
RecordFilterConfig.Builder().setRecordFilterType(RecordFilterFactory.RecordFilterType.FILTER_FUNCTION)
- .setFilterFunction("badFunction()").build();
- try {
- RecordFilterFactory.getRecordFilter(recordFilterConfig);
- fail("Should not pass for invalid filter function");
- } catch (IllegalStateException e) {
- // expected
- }
- recordFilterConfig =
- new
RecordFilterConfig.Builder().setRecordFilterType(RecordFilterFactory.RecordFilterType.FILTER_FUNCTION)
- .setFilterFunction("Groovy({colA == 3},colA)").build();
- recordFilter = RecordFilterFactory.getRecordFilter(recordFilterConfig);
- assertEquals(recordFilter.getClass(), FunctionEvaluatorRecordFilter.class);
- }
-
- @Test
- public void testPartitionFilter() {
- RecordFilterConfig filterConfig =
- new
RecordFilterConfig.Builder().setRecordFilterType(RecordFilterFactory.RecordFilterType.FILTER_FUNCTION)
- .setFilterFunction("Groovy({Integer.valueOf(colA) < 10 ||
Integer.valueOf(colB) > 20},colA, colB)").build();
- RecordFilter recordFilter =
RecordFilterFactory.getRecordFilter(filterConfig);
-
- GenericRow row = new GenericRow();
- row.putValue("colA", "5");
- row.putValue("colB", "5");
- assertTrue(recordFilter.filter(row));
- row.putValue("colA", "15");
- row.putValue("colB", "30");
- assertTrue(recordFilter.filter(row));
- row.putValue("colA", 5);
- row.putValue("colB", 15);
- assertTrue(recordFilter.filter(row));
- row.putValue("colA", "10");
- row.putValue("colB", "20");
- assertFalse(recordFilter.filter(row));
- }
-}
diff --git
a/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordTransformerTest.java
b/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordTransformerTest.java
deleted file mode 100644
index 5abf6dd2fe..0000000000
---
a/pinot-core/src/test/java/org/apache/pinot/core/segment/processing/framework/RecordTransformerTest.java
+++ /dev/null
@@ -1,89 +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.pinot.core.segment.processing.framework;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import
org.apache.pinot.core.segment.processing.transformer.NoOpRecordTransformer;
-import org.apache.pinot.core.segment.processing.transformer.RecordTransformer;
-import
org.apache.pinot.core.segment.processing.transformer.RecordTransformerConfig;
-import
org.apache.pinot.core.segment.processing.transformer.RecordTransformerFactory;
-import
org.apache.pinot.core.segment.processing.transformer.TransformFunctionRecordTransformer;
-import org.apache.pinot.spi.data.readers.GenericRow;
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-
-/**
- * Tests for {@link RecordTransformer}
- */
-public class RecordTransformerTest {
-
- @Test
- public void testRecordTransformerFactory() {
- RecordTransformerConfig config = new
RecordTransformerConfig.Builder().build();
- RecordTransformer recordTransformer =
RecordTransformerFactory.getRecordTransformer(config);
- assertEquals(recordTransformer.getClass(), NoOpRecordTransformer.class);
-
- Map<String, String> transformFunctionMap = new HashMap<>();
- config = new
RecordTransformerConfig.Builder().setTransformFunctionsMap(transformFunctionMap).build();
- recordTransformer = RecordTransformerFactory.getRecordTransformer(config);
- assertEquals(recordTransformer.getClass(),
TransformFunctionRecordTransformer.class);
-
- transformFunctionMap.put("foo", "toEpochDays(foo)");
- config = new
RecordTransformerConfig.Builder().setTransformFunctionsMap(transformFunctionMap).build();
- recordTransformer = RecordTransformerFactory.getRecordTransformer(config);
- assertEquals(recordTransformer.getClass(),
TransformFunctionRecordTransformer.class);
-
- transformFunctionMap.put("bar", "badFunction()");
- config = new
RecordTransformerConfig.Builder().setTransformFunctionsMap(transformFunctionMap).build();
- try {
- RecordTransformerFactory.getRecordTransformer(config);
- fail("Should not create record transformer with invalid transform
function");
- } catch (IllegalStateException e) {
- // expected
- }
- }
-
- @Test
- public void testRecordTransformer() {
- Map<String, String> transformFunctionMap = new HashMap<>();
- transformFunctionMap.put("foo", "toEpochDays(foo)");
- transformFunctionMap.put("bar", "Groovy({bar + \"_\" + zoo}, bar, zoo)");
- transformFunctionMap.put("dMv", "Groovy({dMv.findAll { it > 1}}, dMv)");
- RecordTransformerConfig config =
- new
RecordTransformerConfig.Builder().setTransformFunctionsMap(transformFunctionMap).build();
- RecordTransformer recordTransformer =
RecordTransformerFactory.getRecordTransformer(config);
- GenericRow row = new GenericRow();
- row.putValue("foo", 1587410614000L);
- row.putValue("bar", "dimValue1");
- row.putValue("zoo", "dimValue2");
- row.putValue("dMv", new Object[]{1, 2, 3});
- GenericRow transformRecord = recordTransformer.transformRecord(row);
- assertEquals(transformRecord.getValue("foo"), 18372L);
- assertEquals(transformRecord.getValue("bar"), "dimValue1_dimValue2");
- assertEquals(transformRecord.getValue("zoo"), "dimValue2");
- assertTrue(Arrays.equals(((ArrayList<Object>)
transformRecord.getValue("dMv")).toArray(), new Object[]{2, 3}));
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]