You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "krishan1390 (via GitHub)" <gi...@apache.org> on 2025/10/07 05:26:10 UTC
[PR] Create Cluster conf for No dict stats collector [pinot]
krishan1390 opened a new pull request, #16967:
URL: https://github.com/apache/pinot/pull/16967
Followup PR for https://github.com/apache/pinot/pull/16845/files where the NoDictStatsCollector is enabled based on a cluster config
(**) Use `release-notes` label for scenarios like:
- Added pinot.stats.optimize.no.dict.collection to enable NoDictStatsCollector for non dictionary columns
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "krishan1390 (via GitHub)" <gi...@apache.org>.
krishan1390 commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413160504
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ return;
+ }
+ // Accept only explicit true/false, ignore invalid values by resetting to null to fall back to table config
+ String lower = v.trim().toLowerCase();
+ if ("true".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.TRUE);
+ } else if ("false".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.FALSE);
+ } else {
+ LOGGER.warn("Invalid value: {} for config: {}, ignoring and falling back to table config", v,
+ OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ }
+ }
+ }
+
+ /** Returns whether we should use the optimized collector, applying cluster-level override if set. */
+ public static boolean useOptimizedNoDictCollector(TableConfig tableConfig) {
Review Comment:
cool. will add schema in future work related to dictionary. hope thats fine
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16967:
URL: https://github.com/apache/pinot/pull/16967#issuecomment-3375348936
## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/16967?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `19.23077%` with `21 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 56.01%. Comparing base ([`c823f73`](https://app.codecov.io/gh/apache/pinot/commit/c823f73af5925bf731d187b66bb8797bd9b9f23f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4605689`](https://app.codecov.io/gh/apache/pinot/commit/4605689ce27ec83373ace0be62888b6a47f6dc3e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/pinot/pull/16967?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...not/segment/local/utils/ClusterConfigForTable.java](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&filepath=pinot-segment-local%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsegment%2Flocal%2Futils%2FClusterConfigForTable.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91dGlscy9DbHVzdGVyQ29uZmlnRm9yVGFibGUuamF2YQ==) | 17.39% | [18 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...ocal/segment/index/loader/ForwardIndexHandler.java](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&filepath=pinot-segment-local%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsegment%2Flocal%2Fsegment%2Findex%2Floader%2FForwardIndexHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC9zZWdtZW50L2luZGV4L2xvYWRlci9Gb3J3YXJkSW5kZXhIYW5kbGVyLmphdmE=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...loader/defaultcolumn/BaseDefaultColumnHandler.java](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&filepath=pinot-segment-local%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpinot%2Fsegment%2Flocal%2Fsegment%2Findex%2Floader%2Fdefaultcolumn%2FBaseDefaultColumnHandler.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC9zZWdtZW50L2luZGV4L2xvYWRlci9kZWZhdWx0Y29sdW1uL0Jhc2VEZWZhdWx0Q29sdW1uSGFuZGxlci5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/pinot/pull/16967?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (c823f73) and HEAD (4605689). Click for more details.
>
> <details><summary>HEAD has 32 uploads less than BASE</summary>
>
>| Flag | BASE (c823f73) | HEAD (4605689) |
>|------|------|------|
>|java-21|4|1|
>|unittests1|2|1|
>|unittests|3|1|
>|temurin|9|1|
>|java-11|5|0|
>|unittests2|1|0|
>|integration|6|0|
>|integration1|2|0|
>|custom-integration1|2|0|
>|integration2|2|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #16967 +/- ##
============================================
- Coverage 63.31% 56.01% -7.31%
+ Complexity 1411 701 -710
============================================
Files 3074 2411 -663
Lines 180724 133915 -46809
Branches 27661 21316 -6345
============================================
- Hits 114418 75007 -39411
+ Misses 57513 52673 -4840
+ Partials 8793 6235 -2558
```
| [Flag](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [custom-integration1](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration1](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [integration2](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-11](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [java-21](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.01% <19.23%> (-0.01%)` | :arrow_down: |
| [temurin](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.01% <19.23%> (-7.31%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.01% <19.23%> (-7.30%)` | :arrow_down: |
| [unittests1](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `56.01% <19.23%> (-0.05%)` | :arrow_down: |
| [unittests2](https://app.codecov.io/gh/apache/pinot/pull/16967/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/pinot/pull/16967?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413144606
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
Review Comment:
should empty string be treated as null as well here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "krishan1390 (via GitHub)" <gi...@apache.org>.
krishan1390 commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413158142
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
Review Comment:
it will be eventually when it doesn't equal to true or false and is logged as invalid and removed from CLUSTER_BOOLEAN_FLAGS
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps merged PR #16967:
URL: https://github.com/apache/pinot/pull/16967
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413202243
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
Review Comment:
ok
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "krishan1390 (via GitHub)" <gi...@apache.org>.
krishan1390 commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413158142
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
Review Comment:
it will be eventually when it doesn't equal to true or false
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413201401
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ return;
+ }
+ // Accept only explicit true/false, ignore invalid values by resetting to null to fall back to table config
+ String lower = v.trim().toLowerCase();
+ if ("true".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.TRUE);
+ } else if ("false".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.FALSE);
+ } else {
+ LOGGER.warn("Invalid value: {} for config: {}, ignoring and falling back to table config", v,
+ OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ }
+ }
+ }
+
+ /** Returns whether we should use the optimized collector, applying cluster-level override if set. */
+ public static boolean useOptimizedNoDictCollector(TableConfig tableConfig) {
Review Comment:
yes that works!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org
Re: [PR] Create Cluster conf for No dict stats collector [pinot]
Posted by "KKcorps (via GitHub)" <gi...@apache.org>.
KKcorps commented on code in PR #16967:
URL: https://github.com/apache/pinot/pull/16967#discussion_r2413140212
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/ClusterConfigForTable.java:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.segment.local.utils;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import org.apache.pinot.spi.config.provider.PinotClusterConfigChangeListener;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Contains cluster level config for certain table config attributes.
+ * This is useful for enabling/disabling certain features across the cluster
+ * Each individual config will have its own precedence rules.
+ */
+public final class ClusterConfigForTable {
+
+ // Controls whether to use NoDictColumnStatisticsCollector for no-dictionary columns globally.
+ // If unset at cluster level, table-level config is used.
+ // If cluster level is set to true/false, it overrides the table-level config.
+ private static final String OPTIMISE_NO_DICT_STATS_COLLECTION_CONF = "pinot.stats.optimize.no.dict.collection";
+
+ private ClusterConfigForTable() {
+ }
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ClusterConfigForTable.class);
+ // if a key isn't present, it means it is not set at cluster level
+ private static final Map<String, Boolean> CLUSTER_BOOLEAN_FLAGS = new ConcurrentHashMap<>();
+
+ /** Listener that updates the cached cluster override on config changes. */
+ public static class ConfigChangeListener implements PinotClusterConfigChangeListener {
+ @Override
+ public void onChange(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ checkNoDictStatsCollectorConfig(changedConfigs, clusterConfigs);
+ }
+
+ private void checkNoDictStatsCollectorConfig(Set<String> changedConfigs, Map<String, String> clusterConfigs) {
+ if (!changedConfigs.contains(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF)) {
+ return;
+ }
+ String v = clusterConfigs.get(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ if (v == null) {
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ return;
+ }
+ // Accept only explicit true/false, ignore invalid values by resetting to null to fall back to table config
+ String lower = v.trim().toLowerCase();
+ if ("true".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.TRUE);
+ } else if ("false".equals(lower)) {
+ CLUSTER_BOOLEAN_FLAGS.put(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF, Boolean.FALSE);
+ } else {
+ LOGGER.warn("Invalid value: {} for config: {}, ignoring and falling back to table config", v,
+ OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ CLUSTER_BOOLEAN_FLAGS.remove(OPTIMISE_NO_DICT_STATS_COLLECTION_CONF);
+ }
+ }
+ }
+
+ /** Returns whether we should use the optimized collector, applying cluster-level override if set. */
+ public static boolean useOptimizedNoDictCollector(TableConfig tableConfig) {
Review Comment:
to future proof this method, i think it should also accept the schema since we might have to take decision based on field types.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org