Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: polypheny/Polypheny-DB
ref: master
ref: update-prism-api

- name: Build Polypheny
run: |
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 : '')

Expand Down Expand Up @@ -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'
Expand Down
39 changes: 15 additions & 24 deletions src/main/java/org/polypheny/jdbc/types/PolyDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, TypedValue> {

Expand All @@ -40,31 +36,26 @@ public PolyDocument( HashMap<String, TypedValue> 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<ProtoEntry> 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();
}

}