voonhous commented on code in PR #19613: URL: https://github.com/apache/hudi/pull/19613#discussion_r3773155017
########## rfc/rfc-110/rfc-110.md: ########## @@ -0,0 +1,639 @@ +<!-- + 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. +--> + +# RFC-110: Native Full-Text Search Index + +## Proposers + +- @danny0405 + +## Approvers + +- TBD + +## Status + +Issue: TBD + +> The RFC number is provisional until the community assigns an issue and +> accepts the proposal. RFC-109 is the highest numbered proposal in this +> checkout, so this draft uses RFC-110 to make repository review practical. + +## Abstract + +This RFC proposes a native, relevance-ranked full-text index for Apache Hudi. +It supports token and phrase search over string columns, exposes search through +a Spark table-valued function (TVF), and builds and maintains indexes through +the Hudi metadata table (MDT) indexing lifecycle. + +The search engine follows Lance's useful architectural choices without making +Lance a storage dependency: immutable segments, a compact term dictionary, +compressed posting lists, document-length statistics, BM25 ranking, positions, +and block-max WAND. Hudi owns the analyzer contract and on-disk format. The +format and hot search path are implemented in a Rust crate kept in the Hudi +repository and called through a narrow Java native boundary. + +The MDT remains authoritative for index definitions, visibility, coverage, +rollbacks, and cleaning. Large immutable posting payloads are sidecar files in +an auxiliary directory owned by the MDT rather than values embedded in HFiles. +An MDT commit atomically publishes descriptors for already durable payloads. + +Queries are snapshot-safe. The default `complete` mode combines native index +results with a raw scan of source file slices not covered by a compatible +segment. An opt-in `fast` mode searches only covered data and reports that it +may omit matches. + +## Background + +Hudi indexes currently answer questions such as which files might contain a +record key or a value range. Full-text search has a different contract: analyze +free text into terms, locate matching documents, optionally verify positions, +and rank the best documents. Sending this workload to Elasticsearch or +OpenSearch is effective, but creates a second ingestion pipeline and a second +source of snapshot and retention truth. + +This proposal builds on: + +- [RFC-45](../rfc-45/rfc-45.md), which introduced asynchronous MDT indexing; +- [RFC-77](../rfc-77/rfc-77.md), which established dynamically named secondary + index partitions and index definitions; +- [RFC-102](../rfc-102/rfc-102.md), whose vector-search TVF provides a useful + SQL precedent; and +- RFC-109, the native vector-index proposal listed in the RFC catalog. Text and + vector search should eventually share native artifact packaging, storage + adapters, and top-k execution utilities, but their persistent formats remain + independent. + +### Design principles Review Comment: The design detail here is good, but I think the RFC undersells why we should build this at all. Right now the case for native FTS is three sentences in Background (lines 62-67), and the strongest argument is buried in Alternatives considered at line 107, framed as "why not Tantivy / why not ES as a dependency". That's aimed at reviewers evaluating the design, not at users or committers deciding whether it's worth the ongoing maintenance. For comparison, RFC-102 -- which this RFC cites as its SQL precedent -- spends its Background explaining what embeddings are and why they matter, and has a dedicated User Experience section. RFC-110 has a SQL interface section, but that's a spec rather than a narrative. The examples are `articles` / `body` / "lakehouse indexing", so a reader never sees a workload they recognise. Concretely, I'd like a short "Motivation and use cases" section between Background and Design principles, covering: 1. Actual workloads. Log and observability search, product catalog search, support tickets and CRM text, security and audit investigation, eDiscovery over historical snapshots. Even one or two named workloads with the shape of the query would help. 2. The snapshot-correctness argument, made concrete. "A second source of snapshot and retention truth" is abstract. The version that lands is a failure scenario: a GDPR delete commits to Hudi, the CDC pipeline into Elasticsearch lags or fails, and the search cluster keeps serving the deleted document. Native FTS makes that structurally impossible because the timeline is the index lifecycle. That one example does more work than the whole Alternatives section. 3. Time travel and incremental search. Searching AS OF an older snapshot is something an external search system can't really do without versioning its own index too. This design gets it close to free and never claims it. 4. Hybrid retrieval. RFC-109 shows up at lines 76-79 only as shared "artifact packaging, storage adapters, and top-k execution utilities", i.e. plumbing. BM25 plus vector over one table, one snapshot, one query is probably the most compelling reason to do this inside Hudi rather than beside it. It deserves to be a user-facing benefit, not an implementation note. -- 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]
