You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by sa...@apache.org on 2023/04/03 11:25:34 UTC

[pinot] branch master updated: Fix an error introduced in index-spi that ignores the createInvertedI… (#10524)

This is an automated email from the ASF dual-hosted git repository.

saurabhd336 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 8adb692e4b Fix an error introduced in index-spi that ignores the createInvertedI… (#10524)
8adb692e4b is described below

commit 8adb692e4b15a90b095bcdc364e148f4c0992b68
Author: Gonzalo Ortiz Jaureguizar <go...@users.noreply.github.com>
AuthorDate: Mon Apr 3 13:25:27 2023 +0200

    Fix an error introduced in index-spi that ignores the createInvertedI… (#10524)
    
    * Fix an error introduced in index-spi that ignores the createInvertedIndexDuringSegmentGeneration property
    
    * boolean logic is hard. Fix an error in the fix
    
    * condition rewritten to be easier to read
---
 .../integration/tests/OfflineClusterIntegrationTest.java      |  2 +-
 .../pinot/segment/spi/creator/SegmentGeneratorConfig.java     | 11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
index 10716c2476..1a77e10929 100644
--- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
+++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/OfflineClusterIntegrationTest.java
@@ -138,7 +138,7 @@ public class OfflineClusterIntegrationTest extends BaseClusterIntegrationTestSet
   private static final String COLUMN_LENGTH_MAP_KEY = "columnLengthMap";
   private static final String COLUMN_CARDINALITY_MAP_KEY = "columnCardinalityMap";
   private static final String MAX_NUM_MULTI_VALUES_MAP_KEY = "maxNumMultiValuesMap";
-  private static final int DISK_SIZE_IN_BYTES = 20797370;
+  private static final int DISK_SIZE_IN_BYTES = 20797324;
   private static final int NUM_ROWS = 115545;
 
   private final List<ServiceStatus.ServiceStatusCallback> _serviceStatusCallbacks =
diff --git a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/SegmentGeneratorConfig.java b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/SegmentGeneratorConfig.java
index 6747c10679..16eb45916b 100644
--- a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/SegmentGeneratorConfig.java
+++ b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/SegmentGeneratorConfig.java
@@ -215,16 +215,19 @@ public class SegmentGeneratorConfig implements Serializable {
     _indexConfigsByColName = FieldIndexConfigsUtil.createIndexConfigsByColName(tableConfig, schema);
 
     if (indexingConfig != null) {
-      // NOTE: There are 2 ways to configure creating inverted index during segment generation:
+      // NOTE: By default inverted indexes are not created during segment creation
+      // There are 2 ways to configure creating inverted index during segment generation:
       //       - Set 'generate.inverted.index.before.push' to 'true' in custom config (deprecated)
       //       - Enable 'createInvertedIndexDuringSegmentGeneration' in indexing config
       // TODO: Clean up the table configs with the deprecated settings, and always use the one in the indexing config
       // TODO 2: Decide what to do with this. Index-spi is based on the idea that TableConfig is the source of truth
       if (indexingConfig.getInvertedIndexColumns() != null) {
         Map<String, String> customConfigs = tableConfig.getCustomConfig().getCustomConfigs();
-        if ((customConfigs != null && Boolean.parseBoolean(customConfigs.get(GENERATE_INV_BEFORE_PUSH_DEPREC_PROP)))
-            || indexingConfig.isCreateInvertedIndexDuringSegmentGeneration()) {
-          setIndexOn(StandardIndexes.inverted(), IndexConfig.ENABLED, indexingConfig.getInvertedIndexColumns());
+        boolean customConfigEnabled =
+            customConfigs != null && Boolean.parseBoolean(customConfigs.get(GENERATE_INV_BEFORE_PUSH_DEPREC_PROP));
+        boolean indexingConfigEnable = indexingConfig.isCreateInvertedIndexDuringSegmentGeneration();
+        if (!customConfigEnabled && !indexingConfigEnable) {
+          setIndexOn(StandardIndexes.inverted(), IndexConfig.DISABLED, indexingConfig.getInvertedIndexColumns());
         }
       }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org