Skip to content

Commit

Permalink
Add back GEOMETRY
Browse files Browse the repository at this point in the history
  • Loading branch information
gartens committed Oct 10, 2024
1 parent ec4d6a3 commit cbf8055
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.polypheny.db.type.entity.numerical.PolyInteger;
import org.polypheny.db.type.entity.numerical.PolyLong;
import org.polypheny.db.type.entity.relational.PolyMap;
import org.polypheny.db.type.entity.spatial.PolyGeometry;
import org.polypheny.db.type.entity.temporal.PolyDate;
import org.polypheny.db.type.entity.temporal.PolyTime;
import org.polypheny.db.type.entity.temporal.PolyTimestamp;
Expand Down Expand Up @@ -99,13 +100,20 @@ public static ProtoValue serialize( PolyValue polyValue ) {
case NULL -> serializeAsProtoNull();
case ARRAY -> serializeAsProtoList( polyValue.asList() );
case DOCUMENT -> serializeAsProtoDocument( polyValue.asDocument() );
case GEOMETRY -> serializeGeometry( polyValue.asGeometry() );
case IMAGE, VIDEO, AUDIO, FILE -> serializeAsProtoFile( polyValue.asBlob() ); // used
case MAP, GRAPH, NODE, EDGE, PATH, DISTINCT, STRUCTURED, ROW, OTHER, CURSOR, COLUMN_LIST, DYNAMIC_STAR, SYMBOL, JSON, MULTISET, USER_DEFINED_TYPE, ANY -> throw new NotImplementedException( "Serialization of " + polyValue.getType() + " to proto not implemented" );
default -> throw new NotImplementedException();
};
}


private static ProtoValue serializeGeometry( PolyGeometry geometry ) {
ProtoString asString = ProtoString.newBuilder().setString( geometry.toString() ).build(); // todo add own value, taken from @danylokravchenko
return ProtoValue.newBuilder().setString( asString ).build();
}


private static ProtoValue serializeAsProtoDocument( PolyDocument polyDocument ) {
return ProtoValue.newBuilder()
.setDocument( buildProtoDocument( polyDocument ) )
Expand Down

0 comments on commit cbf8055

Please sign in to comment.