From 6ec140d366da840c237910d0e02842ade90bf5a4 Mon Sep 17 00:00:00 2001 From: Daniel Hornung <d.hornung@indiscale.com> Date: Tue, 21 Jun 2022 17:30:46 +0200 Subject: [PATCH] ENH: Allow testing for actually stored POV values. --- src/main/java/org/caosdb/server/query/POV.java | 17 ++++++++++++++++- .../java/org/caosdb/server/query/TestCQL.java | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/caosdb/server/query/POV.java b/src/main/java/org/caosdb/server/query/POV.java index 43b3ca23..1c04443f 100644 --- a/src/main/java/org/caosdb/server/query/POV.java +++ b/src/main/java/org/caosdb/server/query/POV.java @@ -134,8 +134,8 @@ public class POV implements EntityFilterInterface { this.vDouble = (double) this.vInt; } else { try { + // Doubles are allowed without dots, for example when the integer overflows. final Pattern dp = Pattern.compile("^(-?[0-9]+(?:\\.)?(?:[0-9]+))\\s*([^-]*)$"); - // final Pattern dp = Pattern.compile("^(-?[0-9]+(?:\\.[0-9]+))\\s*([^-]*)$"); final Matcher m = dp.matcher(value); if (!m.matches()) { throw new NumberFormatException(); @@ -522,6 +522,21 @@ public class POV implements EntityFilterInterface { return "String"; } + /** Return the Int value, which may be null. */ + public Integer getVInt() { + return this.vInt; + } + + /** Return the Double value, which may be null. */ + public Double getVDouble() { + return this.vDouble; + } + + /** Return the Datetime value, which may be null. */ + public DateTimeInterface getVDatetime() { + return this.vDatetime; + } + public String getAggregate() { return this.aggregate; } diff --git a/src/test/java/org/caosdb/server/query/TestCQL.java b/src/test/java/org/caosdb/server/query/TestCQL.java index 9abed098..a4b08515 100644 --- a/src/test/java/org/caosdb/server/query/TestCQL.java +++ b/src/test/java/org/caosdb/server/query/TestCQL.java @@ -6931,5 +6931,6 @@ public class TestCQL { System.out.println(pov.getValue()); assertEquals("10000000000", pov.getValue()); assertEquals("Double", pov.getValueType()); + assertEquals(1e10, pov.getVDouble().doubleValue(), 0.0); } } -- GitLab