-
Notifications
You must be signed in to change notification settings - Fork 21
v6: Extend supported data types #448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Switch from representing Weaviate dates as (legacy) Date to modern and more accurate OffsetDateTime, such that the information is not lost
This should disambiguate errors which otherwise appear to refer to Java builin data types. E.g. all numbers extend Number, and yet an exception might say that 'amoung_long' is not a NUMBER property
Use primitive types where possible. Accept int where long is accepted. Accept float where double is accepted. List/Array properties only support Long/Double.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
![]() |
Secrets | ![]() ![]() ![]() ![]() |
View in Orca |
src/main/java/io/weaviate/client6/v1/api/collections/aggregate/GroupedBy.java
Show resolved
Hide resolved
antas-marcin
approved these changes
Aug 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the following data types:
boolean
/boolean[]
number
/number[]
date
/date[]
uuid
/uuid[]
text[]
integer[]
Create new property types
Collection creation API allows creating properties of each of this types via a familiar API.
Aggregation queries
Accordingly, new aggregation metrics are available:
New date format
While working on this PR I learned that
java.util.Date
is considered a legacy class that has been superseded byjava.time.Instant
& co. as of Java 8. The new family of date formats injava.time
are more versatile and flexible, which is whyclient6
now decodes dates intoOffsetDateTime
.OffsetDateTime preserves a lot of the information from the timestamp and can be easily converted to Instant via
OffsetDateTime::toInstant
orDate
viaDate.from(instant)
.New "number" format
Prior to this PR
client6
usedNumber
to represent values of the "number" properties. While technically correct (Number is the base class for all numeric values in Java) this was only coincidental. Using an higher-level type, such as Double, is more accurate and corresponds to the actual value being sent over the wire (in protobuf those properties are represented withdouble
).Same goes for Integer -> Long. Weaviate returns
int64
values, which are best represented asLong
in Java type system.For consistency with the other clients, we follow the naming scheme of calling methods and types the way the data types are called in Weaviate ❗
For example, if I want to get the value of "percentageCarbs" for a group in the aggregation I might to do this:
which will return Double, because that's the underlying Java type.