diff --git a/core/src/main/java/org/polypheny/db/type/entity/PolyBinary.java b/core/src/main/java/org/polypheny/db/type/entity/PolyBinary.java index 3e58392c98..82fe643528 100644 --- a/core/src/main/java/org/polypheny/db/type/entity/PolyBinary.java +++ b/core/src/main/java/org/polypheny/db/type/entity/PolyBinary.java @@ -31,6 +31,7 @@ import java.util.BitSet; import java.util.Objects; import lombok.Value; +import org.apache.calcite.avatica.util.Base64; import org.apache.calcite.avatica.util.ByteString; import org.apache.calcite.linq4j.tree.Expression; import org.apache.calcite.linq4j.tree.Expressions; @@ -125,6 +126,10 @@ public String toHexString() { return out; } + public String as64String() { + return Base64.encodeBytes( value ); + } + @Override public @NotNull PolyString asString() { diff --git a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java index e61ea301d3..c35a3ca997 100644 --- a/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java +++ b/plugins/cottontail-adapter/src/main/java/org/polypheny/db/adapter/cottontail/util/CottontailTypeUtil.java @@ -296,13 +296,21 @@ public static CottontailGrpc.Literal toData( PolyValue value, PolyType actualTyp } break; } + case VARBINARY: + if ( value.isBinary() ) { + return builder.setStringData( value.asBinary().as64String() ).build(); + } + break; case FILE: case IMAGE: case AUDIO: case VIDEO: if ( value.isBlob() ) { return builder.setStringData( value.asBlob().as64String() ).build(); + } else if ( value.isBinary() ) { + return builder.setStringData( value.asBinary().as64String() ).build(); } + break; } log.error( "Conversion not possible! value: {}, type: {}", value.getClass().getCanonicalName(), actualType ); @@ -515,4 +523,4 @@ private static Expression knnCallDistance( RexNode node, ParameterExpression dyn throw new GenericRuntimeException( "Argument is neither an array call nor a dynamic parameter" ); } -} \ No newline at end of file +}