Add PPL multikv command (fixed-schema)#5641
Conversation
PR Reviewer Guide 🔍(Review updated until commit e1b3333)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to e1b3333
Previous suggestionsSuggestions up to commit eedb47b
|
Row-multiplying command that extracts fields from table-formatted text in an input field. Three-layer Calcite rewrite: MULTIKV_SPLIT UDF -> mvexpand (Uncollect/Correlate) -> per-column MULTIKV_EXTRACT UDF -> project. Output columns are resolved at plan time from a fields clause, forceheader, or positional noheader; a bare auto-header form is rejected with guidance. All columns emit VARCHAR (implicit per-op coercion downstream). Signed-off-by: Louis Chu <lingzhichu.clz@gmail.com>
eedb47b to
e1b3333
Compare
|
Persistent review updated to latest commit e1b3333 |
Description
Adds the PPL
multikvcommand: a streaming, row-multiplying command that extracts fields from an input field and emits one row per source record. It requires the Calcite (v3) engine.The input field is selected with
field=<name>(defaults to_raw); output columns are declared withfields <col>....multikvdispatches on the input field's plan-time type:VARCHAR): parse table-formatted text (for exampleps/top/netstat/dfoutput) into columns. Extracted values are typedstring.ARRAY<ANY>): explode into one row per element, reading each declared column from the element and preserving its type.MAP<VARCHAR,ANY>): read each declared column, preserving its type; emits one row.Nested container values are returned serialized (matching the merged
makeresultsconvention); extract deeper fields downstream withspathor anothermultikv field=<subfield>.Design, semantics, and deferred scope (runtime auto-header, aligned-offset parsing,
filter/rmorig, parse-to-MAP optimization) are in the RFC: #5640.Changes
MultikvAST + Calcite lowering, including thefield=<name>input selector,forceheader, andnoheader.visitMultikv: text →MULTIKV_SPLIT/mvexpand/MULTIKV_EXTRACT; array-of-objects →mvexpand+INTERNAL_ITEM; single object →INTERNAL_ITEMonly.multikv(nofields, nonoheader) is rejected at the semantic layer with actionable guidance (v1 is fixed-schema).makeresultsconvention.docs/user/ppl/cmd/multikv.mdand anindex.mdrow.Test coverage
CalcitePPLMultikvTest,AstBuilderTest#testMultikvCommand(incl.field=),PPLQueryDataAnonymizerTest.CalcitePPLMultikvCommandIT(coveringfield=, text, array-of-objects, and single-object modes),NewAddedCommandsIT#testMultikv.Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.