diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4de011..da6a50c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v4 with: repository: polypheny/Polypheny-DB - ref: master + ref: update-prism-api - name: Build Polypheny run: | diff --git a/build.gradle b/build.gradle index 04d56bd..3f3acd2 100644 --- a/build.gradle +++ b/build.gradle @@ -12,8 +12,8 @@ group "org.polypheny" description = "A standards-compliant JDBC driver for Polypheny." -def versionMajor = 2 -def versionMinor = 4 +def versionMajor = 3 +def versionMinor = 0 def versionQualifier = "SNAPSHOT" version = versionMajor + "." + versionMinor + (versionQualifier != '' ? "-" + versionQualifier : '') @@ -50,18 +50,18 @@ java { withSourcesJar() } -def protobufVersion = "3.23.4" +def protobufVersion = '4.28.2' dependencies { // Prism API files (protobuf files), needs to be implementation due to the prism-api-version.properties - implementation group: 'org.polypheny', name: 'prism', version: '1.9' + implementation group: 'org.polypheny', name: 'prism', version: '2.1' // Protobuf implementation group: 'com.google.protobuf', name: 'protobuf-java', version: protobufVersion // Apache Commons Lang - implementation group: "org.apache.commons", name: "commons-lang3", version: "3.17.0" + implementation group: "org.apache.commons", name: "commons-lang3", version: '3.18.0' // Logging implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.16' diff --git a/src/main/java/org/polypheny/jdbc/types/PolyDocument.java b/src/main/java/org/polypheny/jdbc/types/PolyDocument.java index 7e1bfdd..9dbf808 100644 --- a/src/main/java/org/polypheny/jdbc/types/PolyDocument.java +++ b/src/main/java/org/polypheny/jdbc/types/PolyDocument.java @@ -18,13 +18,9 @@ import java.sql.SQLException; import java.util.HashMap; -import java.util.List; import java.util.stream.Collectors; -import org.polypheny.jdbc.utils.ProtoUtils; import org.polypheny.prism.ProtoDocument; -import org.polypheny.prism.ProtoEntry; import org.polypheny.prism.ProtoValue; -import org.polypheny.prism.ProtoValue.ValueCase; public class PolyDocument extends HashMap { @@ -40,31 +36,26 @@ public PolyDocument( HashMap entries ) { public PolyDocument( ProtoDocument document ) { super(); - document.getEntriesList().stream() - .filter( e -> e.getKey().getValueCase() == ValueCase.STRING ) - .forEach( e -> put( - e.getKey().getString().getString(), - new TypedValue( e.getValue() ) + document.getEntriesMap() + .forEach( ( k, v ) -> put( + k, + new TypedValue( v ) ) ); } - public ProtoDocument serialize() { - List protoEntries = entrySet().stream().map( entry -> { - ProtoValue protoKey = ProtoUtils.serializeAsProtoString( entry.getKey() ); - ProtoValue protoValue; - try { - protoValue = entry.getValue().serialize(); - } catch ( SQLException e ) { - throw new RuntimeException( "Should not be thrown. Unknown value encountered." ); - } - return ProtoEntry.newBuilder() - .setKey( protoKey ) - .setValue( protoValue ) - .build(); - } ).collect( Collectors.toList() ); + private ProtoValue serializeValue( TypedValue value ) { + try { + return value.serialize(); + } catch ( SQLException e ) { + throw new RuntimeException( "Cannot serialize value: ", e ); + } + } - return ProtoDocument.newBuilder().addAllEntries( protoEntries ).build(); + + public ProtoDocument serialize() { + return ProtoDocument.newBuilder().putAllEntries( entrySet().stream().collect( + Collectors.toMap( Entry::getKey, e -> serializeValue( e.getValue() ) ) ) ).build(); } }