Skip to content

Incorrect field type retrieved on RemoteDatabase with get(<prop>) #2246

@mdre

Description

@mdre

When retrieve a vertex in RemoteDatabase, the get() return an incorrect field type.

This is the test case:

create vertex type SimpleVertex if not exists;
alter type SimpleVertex custom javaClass='test.SimpleVertex';

create property SimpleVertex.uuid if not exists STRING;
create property SimpleVertex.s  if not exists  STRING;
create property SimpleVertex.i  if not exists  INTEGER;
create property SimpleVertex.f  if not exists FLOAT;
create property SimpleVertex.b  if not exists BOOLEAN;
create property SimpleVertex.fecha  if not exists  DATETIME;
create property SimpleVertex.serial  if not exists LONG;
create property SimpleVertex.oI  if not exists INTEGER;
create property SimpleVertex.oF  if not exists FLOAT;
create property SimpleVertex.oB  if not exists  BOOLEAN;
RemoteMutableVertex nvSaved = db.newVertex("SimpleVertex");
nvSaved.set("s", "string");
nvSaved.set("b", true);
nvSaved.set("oB", true);
float f = 1.0f;
nvSaved.set("f", f);
nvSaved.set("oF", 1.0f);
nvSaved.set("i", 1);
nvSaved.set("oI", 1);
LocalDateTime targetDate = LocalDateTime.now().truncatedTo(ChronoUnit.MILLIS);
nvSaved.set("fecha", targetDate);
nvSaved.save();

db.commit();
RID rid = nvSaved.getIdentity();
System.out.println("RID: "+rid.toString()+"\n\n");

MutableVertex v = db.lookupByRID(rid).asVertex().modify();
v.reload();

System.out.println("retrieved: "+v.getIdentity().toString());
System.out.println("s: "+v.get("s")+" - "+v.get("s").getClass().getName());
System.out.println("b: "+v.get("b")+" - "+v.get("b").getClass().getName());
System.out.println("ob: "+v.get("oB")+" - "+v.get("oB").getClass().getName());
System.out.println("f: "+v.get("f")+" - "+v.get("f").getClass().getName());
System.out.println("f: "+v.getFloat("f")+" - "+v.getFloat("f").getClass().getName());
System.out.println("oF: "+v.get("oF")+" - "+v.get("oF").getClass().getName());
System.out.println("i: "+v.get("i")+" - "+v.get("i").getClass().getName());
System.out.println("oI: "+v.get("oI")+" - "+v.get("oI").getClass().getName());
System.out.println("date: "+v.get("fecha")+" - "+v.get("fecha").getClass().getName());
System.out.println("getDate: "+v.getDate("fecha")+" - "+v.getDate("fecha").getClass().getName());
System.out.println("targetDate: "+targetDate.toInstant(ZoneOffset.UTC) +" --> ret.date: " + v.getLocalDateTime("fecha").toInstant(ZoneOffset.UTC) + " = " + (targetDate.equals(v.getLocalDateTime("fecha"))) );

and this is the output:

retrieved: #4:312
s: string - java.lang.String
b: true - java.lang.Boolean
ob: true - java.lang.Boolean
f: 1.0 - java.lang.Double
f: 1.0 - java.lang.Float
oF: 1.0 - java.lang.Double
i: 1 - java.lang.Integer
oI: 1 - java.lang.Integer
date: 2025-06-02 18:33:27.023 - java.lang.String
getDate: Mon Jun 02 18:33:27 ART 2025 - java.util.Date
targetDate: 2025-06-02T18:33:27.023Z --> ret.date: 2025-06-02T18:33:27.023Z = true

Calling get() return an incorrect type with Float and Date.
The first "f" is when I use get("f") and the second when I call getFloat("f").
Something similar with the field "fecha". get("fecha") return an String.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions