jerry-024 commented on code in PR #8000: URL: https://github.com/apache/paimon/pull/8000#discussion_r3466336435
########## paimon-eslib/src/main/java/org/apache/paimon/eslib/index/ESIndexGlobalIndexerFactory.java: ########## @@ -0,0 +1,123 @@ +/* + * 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.paimon.eslib.index; + +import org.apache.paimon.globalindex.GlobalIndexer; +import org.apache.paimon.globalindex.GlobalIndexerFactory; +import org.apache.paimon.options.Options; +import org.apache.paimon.types.DataField; + +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * Factory for creating ES multi-index global indexers. Supports vector (DiskBBQ/HNSW/Native), + * fulltext (BM25), and scalar fields. + */ +public class ESIndexGlobalIndexerFactory implements GlobalIndexerFactory { + + public static final String IDENTIFIER = "es-index"; + + private static final String READ_SEARCH_THREADS_KEY = + "global-index.es-index.read-search-threads"; + private static final int DEFAULT_READ_SEARCH_THREADS = -1; + + private static volatile ExecutorService readSearchExecutor; + private static final Object LOCK = new Object(); + + @Override + public String identifier() { + return IDENTIFIER; + } + + @Override + public boolean supportsFullTextSearch() { + // The ES index is a hybrid backend: a FULLTEXT-typed column (whether it is the primary + // index field or an extra field of a multi-column index) is served by Lucene full-text + // search. Without this override FullTextScanImpl filters out every es-index file and the + // planner full-text path returns nothing. + return true; Review Comment: This is broader than the reader can safely support. String fields default to KEYWORD in `ESIndexOptions` unless an analyzer/type=fulltext is configured, but `FullTextScanImpl` only knows `supportsFullTextSearch()` at the index-type level. For an `es-index` on a KEYWORD string column, full-text scan will treat the indexed range as covered, produce index splits, and then `visitFullTextSearch()` returns `Optional.empty()` for that field; because the range is considered indexed, no raw split is added, so the full-text query can produce false negatives. This should be gated on actual field config/metadata or avoid claiming full-text support for all ES index files. ########## paimon-eslib/src/main/java/org/apache/paimon/eslib/index/ESIndexOptions.java: ########## @@ -0,0 +1,228 @@ +/* + * 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.paimon.eslib.index; + +import org.apache.paimon.options.Options; +import org.apache.paimon.types.ArrayType; +import org.apache.paimon.types.DataField; +import org.apache.paimon.types.DataType; +import org.apache.paimon.types.DataTypeRoot; +import org.apache.paimon.types.VectorType; + +import org.elasticsearch.eslib.api.model.BuiltinAnalyzer; +import org.elasticsearch.eslib.api.model.FieldIndexConfig; +import org.elasticsearch.eslib.api.model.ScalarFieldType; +import org.elasticsearch.eslib.api.model.VectorAlgorithm; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * Parses Paimon Options into ESLib FieldIndexConfig for each field. + * + * <p>Options format (in table properties): + * + * <pre> + * global-index.es-index.fields.vector_field.algorithm = diskbbq + * global-index.es-index.fields.vector_field.dimension = 128 + * global-index.es-index.fields.text_field.analyzer = standard Review Comment: The documented option keys here do not match what the parser reads below. The examples use `global-index.es-index.fields.<field>...`, but `parseFieldConfig()` builds keys from `FIELDS_PREFIX = "fields."`, so users following this comment will have analyzer/algorithm/dimension/type silently ignored. This also differs from the native vector parser, which accepts index-type-level keys separately and then field-level `fields.<field>...` overrides. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
