Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-server
Commits
c7b2ab0e
Commit
c7b2ab0e
authored
2 years ago
by
Daniel Hornung
Browse files
Options
Downloads
Patches
Plain Diff
FIX: POV.java: Fixed unit-induced value conversion.
parent
268b0792
No related branches found
No related tags found
2 merge requests
!66
REL: prepare release 0.8.0
,
!62
Fix large integer queries
Pipeline
#24678
passed
2 years ago
Stage: info
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/caosdb/server/query/POV.java
+12
-6
12 additions, 6 deletions
src/main/java/org/caosdb/server/query/POV.java
with
12 additions
and
6 deletions
src/main/java/org/caosdb/server/query/POV.java
+
12
−
6
View file @
c7b2ab0e
...
@@ -63,6 +63,7 @@ public class POV implements EntityFilterInterface {
...
@@ -63,6 +63,7 @@ public class POV implements EntityFilterInterface {
private
DateTimeInterface
vDatetime
;
private
DateTimeInterface
vDatetime
;
private
final
String
aggregate
;
private
final
String
aggregate
;
private
String
targetSet
=
null
;
private
String
targetSet
=
null
;
private
String
unitStr
=
null
;
private
Unit
unit
=
null
;
private
Unit
unit
=
null
;
private
Long
stdUnitSig
=
null
;
private
Long
stdUnitSig
=
null
;
private
Double
vDoubleConvertedToStdUnit
=
null
;
private
Double
vDoubleConvertedToStdUnit
=
null
;
...
@@ -112,7 +113,6 @@ public class POV implements EntityFilterInterface {
...
@@ -112,7 +113,6 @@ public class POV implements EntityFilterInterface {
// parse value to int/double/datetime
// parse value to int/double/datetime
if
(
this
.
value
!=
null
)
{
if
(
this
.
value
!=
null
)
{
String
unitStr
=
null
;
// try and parse as integer
// try and parse as integer
try
{
try
{
...
@@ -122,7 +122,7 @@ public class POV implements EntityFilterInterface {
...
@@ -122,7 +122,7 @@ public class POV implements EntityFilterInterface {
throw
new
NumberFormatException
();
throw
new
NumberFormatException
();
}
}
final
String
vIntStr
=
m
.
group
(
1
);
final
String
vIntStr
=
m
.
group
(
1
);
unitStr
=
m
.
group
(
2
);
this
.
unitStr
=
m
.
group
(
2
);
this
.
vInt
=
Integer
.
parseInt
(
vIntStr
);
this
.
vInt
=
Integer
.
parseInt
(
vIntStr
);
}
catch
(
final
NumberFormatException
e
)
{
}
catch
(
final
NumberFormatException
e
)
{
this
.
vInt
=
null
;
this
.
vInt
=
null
;
...
@@ -138,7 +138,7 @@ public class POV implements EntityFilterInterface {
...
@@ -138,7 +138,7 @@ public class POV implements EntityFilterInterface {
throw
new
NumberFormatException
();
throw
new
NumberFormatException
();
}
}
final
String
vDoubleStr
=
m
.
group
(
1
);
final
String
vDoubleStr
=
m
.
group
(
1
);
unitStr
=
m
.
group
(
2
);
this
.
unitStr
=
m
.
group
(
2
);
this
.
vDouble
=
Double
.
parseDouble
(
vDoubleStr
);
this
.
vDouble
=
Double
.
parseDouble
(
vDoubleStr
);
}
catch
(
final
NumberFormatException
e
)
{
}
catch
(
final
NumberFormatException
e
)
{
...
@@ -146,16 +146,17 @@ public class POV implements EntityFilterInterface {
...
@@ -146,16 +146,17 @@ public class POV implements EntityFilterInterface {
}
}
}
}
if
(
this
.
vDouble
!=
null
&&
unitStr
!=
null
&&
unitStr
.
length
()
>
0
)
{
if
((
this
.
vDouble
!=
null
||
this
.
vInt
!=
null
)
&&
this
.
unitStr
!=
null
&&
this
.
unitStr
.
length
()
>
0
)
{
try
{
try
{
this
.
unit
=
getUnit
(
unitStr
);
this
.
unit
=
getUnit
(
this
.
unitStr
);
}
catch
(
final
ParserException
e
)
{
}
catch
(
final
ParserException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
UnsupportedOperationException
(
"Could not parse the unit."
);
throw
new
UnsupportedOperationException
(
"Could not parse the unit."
);
}
}
this
.
stdUnitSig
=
this
.
unit
.
normalize
().
getSignature
();
this
.
stdUnitSig
=
this
.
unit
.
normalize
().
getSignature
();
this
.
vDoubleConvertedToStdUnit
=
this
.
unit
.
convert
(
this
.
vDouble
);
}
}
// try and parse as datetime
// try and parse as datetime
try
{
try
{
...
@@ -285,6 +286,11 @@ public class POV implements EntityFilterInterface {
...
@@ -285,6 +286,11 @@ public class POV implements EntityFilterInterface {
}
}
callPOV
.
setDouble
(
8
,
this
.
vDouble
);
callPOV
.
setDouble
(
8
,
this
.
vDouble
);
}
}
// finally: do unit conversion
if
(
this
.
unitStr
!=
null
&&
this
.
unitStr
.
length
()
>
0
)
{
this
.
vDoubleConvertedToStdUnit
=
this
.
unit
.
convert
(
this
.
vDouble
!=
null
?
this
.
vDouble
:
vDoubleSubst
);
}
}
else
{
}
else
{
callPOV
.
setNull
(
7
,
INTEGER
);
callPOV
.
setNull
(
7
,
INTEGER
);
callPOV
.
setNull
(
8
,
DOUBLE
);
callPOV
.
setNull
(
8
,
DOUBLE
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment