feat(unnest): 增加表函数平铺支持 - #32
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #32 +/- ##
============================================
+ Coverage 88.17% 88.36% +0.18%
- Complexity 1832 1873 +41
============================================
Files 77 78 +1
Lines 4898 5026 +128
Branches 765 784 +19
============================================
+ Hits 4319 4441 +122
- Misses 259 260 +1
- Partials 320 325 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
unnest/explode表函数平铺能力,支持以 SQL 方言更通用的方式展开数组、集合、Map entries 和有限 Publisher。FROM unnest(...)或cross join unnest(...)表达,减少对flat_array固定写法的依赖。核心变动
DefaultReactorQL:支持在 join 右侧使用TableFunction,让cross join unnest(src.items) as u(value)能访问左侧当前行上下文。UnnestFeature:新增unnest/explode表函数实现,支持单参数、多参数、别名列、Map key/value 和命名列映射。DefaultReactorQLMetadata:注册unnest、explode表函数,补充array、array_value、list_value、list_pack数组构造函数,并为 select flat-map 注册unnest、explode、each别名。ValueMapFeature:支持ARRAY[...]构造表达式,并避免表函数与 flat-map 函数同名时误报使用位置。设计与测试目标
ARRAY[...]构造和flat_array兼容别名。UnnestFeature已补类级说明,join 表函数上下文传递处已补关键逻辑注释,不涉及 SPI 方法新增。unnest/explode/ARRAY[...]用法,不涉及数据库连接、索引、分页或原生 SQL 下推。测试结果
mvn testUnnestFeatureTest覆盖表函数默认列名、别名列、空参数、cross join、Map entries、命名列映射、有限 Publisher 和unnest/explode/eachflat-map 别名;ReactorQLTest补充方言兼容平铺、表函数、cross join 和 Map entries 场景。文档同步情况
unnest用法。风险与说明
UnnestFeature类注释和 join 表函数处理注释,不涉及 SPI 契约变更。unnest参数的长期运行场景;该能力应只用于有限数组、集合、Map entries 或有限流。unnest会先收集各参数展开结果后按最大长度补齐,适合有限参数;对无界流应继续使用流式算子组合而不是表函数 zip 展开。