Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public enum FieldType {
OBJECT("object"),
FLAT_OBJECT("flat_object"),
COMPLETION("completion"),

// ── Composite ────────────────────────────────────────────────────
/**
* Array-typed expression result. Used for the return-type slot of array-producing scalar
* functions (PPL {@code array(…)}, {@code array_slice}, {@code array_distinct}). Has no
Expand All @@ -67,15 +69,16 @@ public enum FieldType {
ARRAY("array"),

/**
* Map-typed expression result. First in-tree producer is PPL `spath`'s auto-extract mode
* (`JSON_EXTRACT_ALL` returns {@code MAP<VARCHAR, VARCHAR>}). Mapping string is {@code
* "map"} as a placeholder — no OpenSearch storage format declares this mapping today, so
* {@link #fromMappingType} never resolves to it through the mapping path; columns reach
* MAP only through {@link #fromSqlTypeName}. Capability registrations for filter / project
* operators on MAP columns are intentionally minimal: callers (e.g. PPL `where doc.user.name`)
* always wrap the MAP column in an ITEM lookup whose result type is the map's value type,
* so the EQUALS / sort / aggregate operators see the value-level type by the time the
* runtime executes them.
* Map-typed expression result. In-tree producers include PPL {@code spath}'s auto-extract
* mode ({@code JSON_EXTRACT_ALL} returns {@code MAP<VARCHAR, VARCHAR>}) and PPL
* {@code parse} (named regex groups returned as {@code MAP<VARCHAR, VARCHAR>}). Mapping
* string is {@code "map"} as a placeholder — no OpenSearch storage format declares this
* mapping today, so {@link #fromMappingType} never resolves to it through the mapping
* path; columns reach MAP only through {@link #fromSqlTypeName}. Capability registrations
* for filter / project operators on MAP columns are intentionally minimal: callers (e.g.
* PPL {@code where doc.user.name}) always wrap the MAP column in an ITEM lookup whose
* result type is the map's value type, so the EQUALS / sort / aggregate operators see
* the value-level type by the time the runtime executes them.
*/
MAP("map");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ public enum ScalarFunction {
REX_EXTRACT(Category.STRING, SqlKind.OTHER_FUNCTION),
REX_EXTRACT_MULTI(Category.STRING, SqlKind.OTHER_FUNCTION),
REX_OFFSET(Category.STRING, SqlKind.OTHER_FUNCTION),
/**
* PPL {@code parse <field> '<regex>'} — extracts named regex groups into a
* {@code MAP<VARCHAR, VARCHAR>}. Resolves by identifier-name through
* {@link #fromSqlFunction(SqlFunction)} ({@code SqlKind.OTHER_FUNCTION}
* shared with many scalar UDFs). Pairs with {@link #ITEM} downstream:
* {@code parse} returns the map, {@code item(map, group)} extracts each
* named group at the call site.
*/
PARSE(Category.STRING, SqlKind.OTHER_FUNCTION),

// TODO: Frontend/lang-specific functions (NUM/AUTO/MEMK/MKTIME etc.) shouldn't
// live in the shared analytics-framework SPI — they couple the framework to PPL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ serde_json = { workspace = true, features = ["preserve_order"] }
# multi-path JSON-array output. Moving to 1.x is a follow-up once we can
# reproduce that distinction against the new API surface.
jsonpath-rust = "=0.7.5"
# mvfind / rex_extract / rex_extract_multi / rex_offset UDFs — Java-Pattern-compatible
# mvfind / parse / rex_extract / rex_extract_multi / rex_offset UDFs — Java-Pattern-compatible
# regex matching. Same crate DataFusion's own regexp_replace / regexp_match are
# built on, so semantics match the existing analytics-engine route's
# `regex_match` operator (Operator::RegexMatch).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ pub async unsafe fn create_session_context(
.build();

let ctx = SessionContext::new_with_state(state);
// Register OpenSearch UDFs (mvappend, mvfind, mvzip, convert_tz, …) on this session
// so the substrait converter at execute_with_context can resolve their function names.
// Without this, fragment execution fails with "Unsupported function name" because
// df_execute_with_context reuses this handle's ctx instead of building a fresh one.
// Register OpenSearch UDFs (parse, item, mvappend, mvfind, mvzip, convert_tz, …)
// on this session so the substrait converter at execute_with_context can resolve
// their function names. Without this, fragment execution fails with "Unsupported
// function name" because df_execute_with_context reuses this handle's ctx instead
// of building a fresh one.
crate::udf::register_all(&ctx);
Comment thread
mch2 marked this conversation as resolved.
Resolved
crate::udaf::register_all(&ctx);

Expand Down
Loading
Loading