diff --git a/gluten-core/src/main/java/org/apache/gluten/substrait/expression/BinaryLiteralNode.java b/gluten-core/src/main/java/org/apache/gluten/substrait/expression/BinaryLiteralNode.java index 864aeb741a15..3d1ee51741ee 100644 --- a/gluten-core/src/main/java/org/apache/gluten/substrait/expression/BinaryLiteralNode.java +++ b/gluten-core/src/main/java/org/apache/gluten/substrait/expression/BinaryLiteralNode.java @@ -22,6 +22,9 @@ import com.google.protobuf.ByteString; import io.substrait.proto.Expression.Literal.Builder; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + public class BinaryLiteralNode extends LiteralNodeWithValue { public BinaryLiteralNode(byte[] value) { super(value, new BinaryTypeNode(true)); @@ -33,6 +36,14 @@ public BinaryLiteralNode(byte[] value, TypeNode typeNode) { @Override protected void updateLiteralBuilder(Builder literalBuilder, byte[] value) { - literalBuilder.setBinary(ByteString.copyFrom(value)); + ByteString byteValue; + try { + Method m = ByteString.class.getDeclaredMethod("wrap", byte[].class); + m.setAccessible(true); + byteValue = (ByteString) m.invoke(null, value); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + throw new RuntimeException(e); + } + literalBuilder.setBinary(byteValue); } }