Commit cdac62e
committed
Convert byte[] cells to base64 ExprStringValue for IP / BINARY fields
`AnalyticsExecutionEngine.convertRows` reaches `ExprValueUtils.fromObjectValue`
for every cell in every row. OpenSearch `ip` and `binary` fields are stored
as raw bytes, so once the analytics-engine reader (paired with OpenSearch
PR #21681 commit 4) materializes a parquet column, each cell arrives as a
Java `byte[]`. The fall-through catch-all previously threw:
ExpressionEvaluationException: unsupported object class [B
at ExprValueUtils.fromObjectValue(ExprValueUtils.java:168)
at AnalyticsExecutionEngine.convertRows(AnalyticsExecutionEngine.java:128)
Every PPL query that even projects an ip column fails on the analytics route
with this error, regardless of operator or predicate.
`OpenSearchSchemaBuilder.mapFieldType` collapses both `ip` and `binary` into
Calcite `VARBINARY`, so the cell-level type system can't distinguish the two.
An earlier draft of this commit gated IP rendering on byte length (4 or 16
bytes → `ExprIpValue` via `InetAddress.getByAddress`), but that misinterprets
any 4-byte ASCII payload (e.g. `"INFO"`, `"WARN"`, `"POST"`) as a public
IPv4 address — the classic "Norway problem" applied to bytes. With no schema
context here we can't safely guess, so default to a base64-encoded
`ExprStringValue`. Typed call sites that DO know the column is `ip` should
route through `ipValue(String)` explicitly.
Once `OpenSearchSchemaBuilder` splits `ip` and `binary` into separate UDTs
(TODO already filed in that file), this branch can render IP cells in
dotted-decimal form again without the length-guessing.
Signed-off-by: Kai Huang <ahkcs@amazon.com>1 parent 4070c28 commit cdac62e
2 files changed
Lines changed: 22 additions & 0 deletions
File tree
- core/src
- main/java/org/opensearch/sql/data/model
- test/java/org/opensearch/sql/data/model
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
247 | 259 | | |
248 | 260 | | |
249 | 261 | | |
| |||
0 commit comments