Skip to content

Commit 05152ad

Browse files
committed
Initial changes to make Lucene work alongside Parquet
Signed-off-by: expani <[email protected]>
1 parent f42e790 commit 05152ad

File tree

24 files changed

+108
-79
lines changed

24 files changed

+108
-79
lines changed

modules/mapper-extras/src/main/java/org/opensearch/index/mapper/ScaledFloatFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ protected void parseCreateField(ParseContext context) throws IOException {
498498
}
499499
long scaledValue = Math.round(doubleValue * scalingFactor);
500500

501-
if (isPluggableDataFormatFeatureEnabled()) {
501+
if (isPluggableDataFormatFeatureEnabled(context)) {
502502
context.compositeDocumentInput().addField(fieldType(), scaledValue);
503503
} else {
504504
List<Field> fields = NumberFieldMapper.NumberType.LONG.createFields(

modules/mapper-extras/src/main/java/org/opensearch/index/mapper/TokenCountFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected void parseCreateField(ParseContext context) throws IOException {
185185
tokenCount = countPositions(analyzer, name(), value, enablePositionIncrements);
186186
}
187187

188-
if (isPluggableDataFormatFeatureEnabled()) {
188+
if (isPluggableDataFormatFeatureEnabled(context)) {
189189
context.compositeDocumentInput().addField(fieldType(), tokenCount);
190190
} else {
191191
context.doc()

plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/DatafusionEngine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ protected void doClose() {
126126
}
127127
};
128128
} catch (Exception ex) {
129-
logger.error("Failed to acquire searcher {}", ex.toString(), ex);
130-
// TODO
129+
logger.error("Failed to acquire searcher", ex);
130+
throw new RuntimeException(ex);
131131
}
132132
return searcher;
133133
}

plugins/mapper-size/src/main/java/org/opensearch/index/mapper/size/SizeFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void postParse(ParseContext context) throws IOException {
100100
}
101101
final int value = context.sourceToParse().source().length();
102102

103-
if (isPluggableDataFormatFeatureEnabled()) {
103+
if (isPluggableDataFormatFeatureEnabled(context)) {
104104
context.compositeDocumentInput().addField(fieldType(), value);
105105
} else {
106106
context.doc().addAll(NumberType.INTEGER.createFields(name(), value, true, true, false, true));

server/src/main/java/org/opensearch/common/settings/IndexScopedSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
289289
IndexSettings.INDEX_DERIVED_SOURCE_SETTING,
290290
IndexSettings.INDEX_DERIVED_SOURCE_TRANSLOG_ENABLED_SETTING,
291291

292+
IndexSettings.OPTIMIZED_INDEX_ENABLED_SETTING,
293+
292294
// validate that built-in similarities don't get redefined
293295
Setting.groupSetting("index.similarity.", (s) -> {
294296
Map<String, Settings> groups = s.getAsGroups();

server/src/main/java/org/opensearch/index/IndexSettings.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,13 @@ public static IndexMergePolicy fromString(String text) {
810810
Property.Dynamic
811811
);
812812

813+
public static final Setting<Boolean> OPTIMIZED_INDEX_ENABLED_SETTING = Setting.boolSetting(
814+
"index.optimized.enabled",
815+
false,
816+
Property.IndexScope,
817+
Property.Final
818+
);
819+
813820
private final Index index;
814821
private final Version version;
815822
private final Logger logger;
@@ -955,6 +962,8 @@ private void setRetentionLeaseMillis(final TimeValue retentionLease) {
955962
*/
956963
private volatile boolean isStarTreeIndexEnabled;
957964

965+
private final boolean isOptimizedIndex;
966+
958967
/**
959968
* Returns the default search fields for this index.
960969
*/
@@ -1119,6 +1128,8 @@ public IndexSettings(final IndexMetadata indexMetadata, final Settings nodeSetti
11191128
setDocIdFuzzySetFalsePositiveProbability(scopedSettings.get(INDEX_DOC_ID_FUZZY_SET_FALSE_POSITIVE_PROBABILITY_SETTING));
11201129
isCompositeIndex = scopedSettings.get(StarTreeIndexSettings.IS_COMPOSITE_INDEX_SETTING);
11211130
isStarTreeIndexEnabled = scopedSettings.get(StarTreeIndexSettings.STAR_TREE_SEARCH_ENABLED_SETTING);
1131+
isOptimizedIndex = scopedSettings.get(OPTIMIZED_INDEX_ENABLED_SETTING);
1132+
11221133
scopedSettings.addSettingsUpdateConsumer(
11231134
TieredMergePolicyProvider.INDEX_COMPOUND_FORMAT_SETTING,
11241135
tieredMergePolicyProvider::setNoCFSRatio
@@ -2166,4 +2177,6 @@ public boolean isDerivedSourceEnabledForTranslog() {
21662177
public boolean isDerivedSourceEnabled() {
21672178
return derivedSourceEnabled;
21682179
}
2180+
2181+
public boolean isOptimizedIndex() { return isOptimizedIndex; }
21692182
}

server/src/main/java/org/opensearch/index/engine/exec/bridge/Indexer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.opensearch.index.engine.EngineException;
1919
import org.opensearch.index.engine.SafeCommitInfo;
2020
import org.opensearch.index.engine.Segment;
21+
import org.opensearch.index.engine.exec.composite.CompositeDataFormatWriter;
2122
import org.opensearch.index.seqno.SequenceNumbers;
2223
import org.opensearch.index.translog.Translog;
2324
import org.opensearch.index.translog.TranslogManager;
@@ -233,6 +234,14 @@ default void maybeDie(final Logger logger, final String maybeMessage, final Thro
233234
});
234235
}
235236

237+
default CompositeDataFormatWriter.CompositeDocumentInput documentInput() {
238+
return null;
239+
}
240+
241+
default long getNativeBytesUsed() {
242+
return 0;
243+
}
244+
236245
/**
237246
* Event listener for the engine
238247
*

server/src/main/java/org/opensearch/index/engine/exec/coord/CompositeEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ LocalCheckpointTracker getLocalCheckpointTracker() {
409409
return readEngines.values().stream().filter(list -> !list.isEmpty()).findFirst().map(List::getFirst).orElse(null);
410410
}
411411

412-
public CompositeDataFormatWriter.CompositeDocumentInput documentInput() throws IOException {
412+
@Override
413+
public CompositeDataFormatWriter.CompositeDocumentInput documentInput() {
413414
return engine.createCompositeWriter().newDocumentInput();
414415
}
415416

server/src/main/java/org/opensearch/index/mapper/BinaryFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ protected void parseCreateField(ParseContext context) throws IOException {
206206
return;
207207
}
208208

209-
if (isPluggableDataFormatFeatureEnabled()) {
209+
if (isPluggableDataFormatFeatureEnabled(context)) {
210210
context.compositeDocumentInput().addField(fieldType(), value);
211211
} else {
212212
if (stored) {

server/src/main/java/org/opensearch/index/mapper/BooleanFieldMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ protected void parseCreateField(ParseContext context) throws IOException {
390390
return;
391391
}
392392

393-
if (isPluggableDataFormatFeatureEnabled()) {
393+
if (isPluggableDataFormatFeatureEnabled(context)) {
394394
context.compositeDocumentInput().addField(fieldType(), value);
395395
} else {
396396
if (indexed) {

0 commit comments

Comments
 (0)