Skip to content

Commit

Permalink
use CastToObjectVectorProcessor for cast to string (apache#17148)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintropolis authored Sep 24, 2024
1 parent 83299e9 commit 0ec7eb3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 55 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ public static <T> ExprVectorProcessor<T> cast(
caster = castInput;
} else {
switch (castToType.getType()) {
case STRING:
caster = new CastToStringVectorProcessor(castInput, maxVectorSize);
break;
case LONG:
caster = new CastToLongVectorProcessor(castInput);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,16 @@ public void testArrayFns()
testExpression("array(s1, l2)", types);
}

@Test
public void testCastArraysRoundTrip()
{
testExpression("cast(cast(s1, 'ARRAY<STRING>'), 'STRING')", types);
testExpression("cast(cast(d1, 'ARRAY<DOUBLE>'), 'DOUBLE')", types);
testExpression("cast(cast(d1, 'ARRAY<STRING>'), 'DOUBLE')", types);
testExpression("cast(cast(l1, 'ARRAY<LONG>'), 'LONG')", types);
testExpression("cast(cast(l1, 'ARRAY<STRING>'), 'LONG')", types);
}

@Test
public void testJsonFns()
{
Expand Down

0 comments on commit 0ec7eb3

Please sign in to comment.