Skip to content

Commit c252e9a

Browse files
committed
fix(core): convert Arrow Text wrappers to ExprStringValue
PPL queries that route through the analytics-engine path can return Arrow {@code org.apache.arrow.vector.util.Text} instances inside Map and List fields (e.g. the {@code tokens} map of {@code patterns ... show_numbered_token=true}). Arrow's Text class extends ReusableByteArray and does not implement CharSequence, so the existing String branch in {@code ExprValueUtils.fromObjectValue} doesn't match it and the fallback throws "unsupported object class org.apache.arrow.vector.util.Text". Detect the type by class name (avoids adding arrow-vector to the {@code core} module's dependency graph just for one instanceof) and treat it the same as a plain Java String. Test impact: CalcitePPLPatternsIT 4/15 → 8/15 via the analytics-engine route — all four SIMPLE pattern {@code show_numbered_token=true} variants deserialize their result rows correctly now. Pairs with the OpenSearch side commit that adds per-field {@code pattern_parser_get_pattern} / {@code pattern_parser_get_tokens} scalar UDFs. Signed-off-by: Kai Huang <ahkcs@amazon.com>
1 parent 6bb8b7a commit c252e9a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

core/src/main/java/org/opensearch/sql/data/model/ExprValueUtils.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ public static ExprValue fromObjectValue(Object o) {
143143
return new ExprDoubleValue(d);
144144
} else if (o instanceof String) {
145145
return stringValue((String) o);
146+
} else if ("org.apache.arrow.vector.util.Text".equals(o.getClass().getName())) {
147+
// Arrow string values inside Maps/Lists come back as Text wrappers
148+
// ({@code org.apache.arrow.vector.util.Text} extends ReusableByteArray
149+
// and does NOT implement CharSequence). Treat them the same as plain
150+
// Strings — observed first from PPL {@code patterns ...
151+
// show_numbered_token=true} where the tokens map's value-lists hold
152+
// Text instead of String. Class-name check avoids adding the
153+
// arrow-vector dep to {@code core} just for this one isinstance.
154+
return stringValue(o.toString());
146155
} else if (o instanceof Float f) {
147156
if (!Float.isFinite(f)) {
148157
return LITERAL_NULL;

0 commit comments

Comments
 (0)