Commit d7c9765
committed
[Analytics Backend] UInt64 β Int64 bridge at partition-stream boundary
Resolves the 13 by-clause failures in CalciteTimechartCommandIT (5/18 β 18/18)
caused by DataFusion's row_number() physical op emitting UInt64 while
Calcite types ROW_NUMBER OVER as BIGINT (Int64 signed). Two coupled
changes mirror the existing schema_coerce::coerce_inferred_schema bridge
the parquet-scan path uses, applied at the partition-stream boundary
where the analytics-engine reduce stage reads from upstream PARTIAL
fragments via NativeBridge.registerPartitionStream.
1. api::register_partition_stream β coerce the producer's physical
schema via schema_coerce before registering the StreamingTable and
before writing the IPC bytes back to Java. The Substrait consumer
plan's `ensure_schema_compatibility` (datafusion-substrait 53)
strict-checks each ReadRel's base_schema against the registered
table; the coercion makes Int64-declared plans bind against this
table. The Java-side typesMatch tripwire then sees the coerced
schema and validates incoming batches against it (next change).
2. api::sender_send β coerce incoming RecordBatches to match the
sender's (now-coerced) schema via arrow::compute::cast where types
differ. Without this, DataFusion's HashJoin / RepartitionExec
panics with "primitive array" on as_primitive::<Int64Type>() of
a UInt64 column when the producer's actual batch reaches downstream
operators. cast() is the existing Arrow kernel β no-op when the
schemas already match, single-cast on the mismatched columns
otherwise. Same width preserves zero-copy semantics modulo the
bit-reinterpret arrow handles internally.
3. DatafusionReduceSink.typesMatch β relax Java's tripwire to treat
same-width Int (any signedness) as compatible, mirroring the existing
Timestamp(any precision) tolerance. Same rationale: divergence is
harmless because the sender_send coercion produces a downstream-
compatible batch.
Pass-rate impact:
- CalciteTimechartCommandIT: 5/18 β 18/18 β
(+13)
- CalciteTimechartPerFunctionIT: 1/12 β 1/12 (residuals are opensearch-project#21584's
multi-unit-SPAN gap +
variable-month TIMESTAMPADD)
- Combined timechart: 6/30 β 19/30 (63%)
Signed-off-by: Kai Huang <huangkaics@gmail.com>1 parent ad1cc9b commit d7c9765
2 files changed
Lines changed: 60 additions & 0 deletions
File tree
- sandbox/plugins/analytics-backend-datafusion
- rust/src
- src/main/java/org/opensearch/be/datafusion
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
796 | 804 | | |
797 | 805 | | |
798 | 806 | | |
| |||
934 | 942 | | |
935 | 943 | | |
936 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
937 | 954 | | |
938 | 955 | | |
939 | 956 | | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
940 | 991 | | |
941 | 992 | | |
942 | 993 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
237 | 243 | | |
238 | 244 | | |
239 | 245 | | |
| |||
247 | 253 | | |
248 | 254 | | |
249 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
250 | 259 | | |
251 | 260 | | |
252 | 261 | | |
| |||
0 commit comments