Skip to content
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

Migrate to text based query parser. #7318

Merged
merged 81 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
8ba609b
Allow argument passing on raw predicates
clementetb Feb 17, 2021
4bf5608
Add object argument substitution
clementetb Feb 17, 2021
b371480
Initial work on adapting typed queries to text based queries
clementetb Feb 22, 2021
a057d86
Check for if the first connector is an OR. Fixes queries extension .
clementetb Feb 22, 2021
7639116
Fix out of bounds exception when trying to find first
clementetb Feb 22, 2021
f265004
Leave nullability checks to query parser
clementetb Feb 22, 2021
680d4a0
Add support for isempty/isnotempty
clementetb Feb 23, 2021
fddd990
Fix isempty implementation
clementetb Feb 23, 2021
ab9567d
Fix get query description
clementetb Feb 23, 2021
3907d84
Avoid appending truepredicates
clementetb Feb 23, 2021
822e18b
Allow passing null strings into string queries
clementetb Feb 23, 2021
3391158
Fix query description test case
clementetb Feb 23, 2021
7cb641f
Stop using field descriptors in realm querys
clementetb Feb 23, 2021
d5c8829
Add raw predicates into the query builder, fix bunch of tests
clementetb Feb 23, 2021
adaa578
Handle query argument list lifecycle
clementetb Feb 24, 2021
19b3064
Adapt pending realmquery test cases
clementetb Feb 25, 2021
ca9b1d1
Reenable and adapt realm result tests
clementetb Feb 25, 2021
0f2e463
Reenable JNI query tests
clementetb Feb 25, 2021
0f0e3bf
Remove non strings based query parser 🚀
clementetb Feb 25, 2021
903871e
Clean up
clementetb Feb 25, 2021
881ade0
Allow to exclude classes from the schema
clementetb Feb 26, 2021
40276b6
Add debug method into the realm configuration builder to allow exclud…
clementetb Feb 26, 2021
2a196c1
Adapt LinkingObjectsQueryTests
clementetb Feb 26, 2021
00c35a4
Fix TestRealmConfigurationFactory to only apply schema filtering when…
clementetb Feb 26, 2021
17010d3
Adapt tests to the string based queries
clementetb Feb 26, 2021
f7e60c3
Styling
clementetb Feb 26, 2021
f13a5fa
Build query by partial predicates
clementetb Mar 1, 2021
eac4588
Fix spotbugs
clementetb Mar 1, 2021
dba1364
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 1, 2021
6911806
Fix Decimal128 deserialization
clementetb Mar 1, 2021
f6c55a4
Disable tests affected by string based core issues
clementetb Mar 2, 2021
13460e9
Remove counts as they are not needed to throw the exceptions.
clementetb Mar 2, 2021
fe8798c
Further cleaning
clementetb Mar 2, 2021
7992ad6
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 15, 2021
4f673d7
Check for null strings
clementetb Mar 16, 2021
b1f4166
Allow null values in string `in` query
clementetb Mar 16, 2021
d83c0ab
Update realm/realm-library/src/androidTest/java/io/realm/UTFStringsTe…
clementetb Mar 16, 2021
0eb4e75
Remove unnecessary counts
clementetb Mar 16, 2021
e28dc74
Add support for handling illegal query argument exception
clementetb Mar 16, 2021
aaeb655
Use IllegalFormatException for IllegalQueryErrors
clementetb Mar 16, 2021
bfdde4d
Rename property link
clementetb Mar 16, 2021
ada5ce2
Core issue 4477 fixed, 4524 in
clementetb Mar 16, 2021
684571a
Reuse getTable
clementetb Mar 16, 2021
7475ef1
Remove getTable without keymapping.
clementetb Mar 16, 2021
0c3b2be
Update changelog
clementetb Mar 16, 2021
24a4e23
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 23, 2021
0b72a68
Update expected exception
clementetb Mar 23, 2021
9a56bfb
Reenable fixed query tests
clementetb Mar 23, 2021
d4b0976
Update changelog to reflect known core bugs
clementetb Mar 23, 2021
b77490c
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 23, 2021
bccd1fc
Fix CI compiling exception
clementetb Mar 23, 2021
98f7299
Fix code style
clementetb Mar 23, 2021
d207bdf
Fix kotlin test cases
clementetb Mar 23, 2021
160663d
Update expected exception message
clementetb Mar 23, 2021
2cf6aa8
Fix UUID test case
clementetb Mar 23, 2021
6874755
Revert "Remove getTable without keymapping."
clementetb Mar 24, 2021
973cf5f
Update CHANGELOG.md
clementetb Mar 24, 2021
e32025f
Update change log message to be more explicit
clementetb Mar 24, 2021
884f88b
Improve changelog updates
clementetb Mar 24, 2021
7c4ae44
Update changelog and update support distinct fields
clementetb Mar 24, 2021
3586ee0
Remove not reachable method calls
clementetb Mar 24, 2021
ca80e8a
Recover or test cases
clementetb Mar 24, 2021
a032f94
Update changelog
clementetb Mar 24, 2021
9b4b525
reenable DynamicRealmTest equalTo_noFieldObjectShouldThrow
clementetb Mar 24, 2021
9da3b22
Encapsulate tests
clementetb Mar 24, 2021
388fc3e
Reenable tests affected by core issue 4469
clementetb Mar 24, 2021
a6745d2
Reenable tests affected by core issue 4475
clementetb Mar 24, 2021
e004400
PR changes
clementetb Mar 24, 2021
c22e528
Remove references to oskeypathmapping
clementetb Mar 24, 2021
644f5da
Use pass keypathmapping on the query calls
clementetb Mar 24, 2021
90de866
Update test cases
clementetb Mar 24, 2021
d20dc75
Remove unnecessary test case
clementetb Mar 24, 2021
a56b79d
Merge branch 'ct/migrate-to-raw-queries' into ct/fix-oskeymapping
clementetb Mar 24, 2021
9e257ee
Merge pull request #7386 from realm/ct/fix-oskeymapping
clementetb Mar 25, 2021
db9ebad
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 25, 2021
37a637b
Reenable non-latin test case
clementetb Mar 25, 2021
c3bb3ca
Merge branch 'ct/mixed-datatype-story' into ct/migrate-to-raw-queries
clementetb Mar 25, 2021
89ccbe5
Reenable test
clementetb Mar 25, 2021
350df13
Sort/distinct do not support backlinks
clementetb Mar 25, 2021
04a046f
Validate distinct/sort is not supported on backlinks
clementetb Mar 25, 2021
dcccda2
Remove changelog entry
clementetb Mar 26, 2021
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
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
## 10.4.0 (YYYY-MM-DD)
### Breaking Changes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this has to bump the major version?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these changes are part of the datatype release which will be a major version bump

* Queries no longer do nullability checks on non-nullable fields, so using `null` as an argument will not throw an `IllegalArgumentException`.
* String query filters `contains`, `beginsWith`, `endsWith`, and `like`, now throw a null pointer exception on null values.
* The query builder no longer throw `IllegalStateException` but `IllegalArgumentException`.

### Enhancements
* Added support for `java.util.UUID` as supported field in model classes.
* Added support for `java.util.UUID` as a primary key.
* Added support for the string-based Realm Query Language through `RealmQuery.rawPredicate(...)`. This allows many new type of queries not previously supported by the typed query API. See the Javadoc on this method for further details. (Issue [#6116](https://github.com/realm/realm-java/pull/6116))
* Queries across relationships now support the `between` operator.
* Queries on numerical fields (byte, short, int, long, float, double, decimal128) now accept any numerical value as an argument.
* The `distinct` query filter on unsupported fields no longer throws an exception when applied through when querying across relationships.
* The `distinct` query filter no longer throws an exception when applied on non-existent fields.
* `isEmpty` query filter can now be applied on `RealmList` and `RealmObject` fields.

### Fixes
* None
### Known Bugs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few other known bugs in realm-java... Not sure it makes sense to list all those :-)
If both these were features that no longer works, perhaps we should list it under Breaking changes instead, and say these are known "breaking limitations"?

* Sort and Distinct operations do not support using the Java field name of fields with a custom name defined. (Issue [#4550] (https://github.com/realm/realm-core/issues/4550))
* Queries on fields named with non-latin characters are not currently supported. (Issue [#4467] (https://github.com/realm/realm-core/issues/4467))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is fine to have this entry when merging this PR, but I would consider this a blocker for releasing.


### Compatibility
* File format: Generates Realms with format v20. Unsynced Realms will be upgraded from Realm Java 2.0 and later. Synced Realms can only be read and upgraded if created with Realm Java v10.0.0-BETA.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import io.realm.entities.AllTypes
import io.realm.entities.Dog
import io.realm.entities.SimpleClass
import io.realm.kotlin.*
import io.realm.log.RealmLog
import io.realm.rule.BlockingLooperThread
import io.realm.rule.TestRealmConfigurationFactory
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.test.TestCoroutineDispatcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import io.realm.entities.SimpleClass
import io.realm.kotlin.*
import io.realm.rule.RunInLooperThread
import io.realm.rule.RunTestInLooperThread
import io.realm.rule.TestRealmConfigurationFactory
import org.junit.*
import org.junit.Assert.*
import org.junit.runner.RunWith
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import io.realm.entities.AllPropTypesClass
import io.realm.kotlin.createObject
import io.realm.kotlin.oneOf
import io.realm.kotlin.where
import io.realm.rule.TestRealmConfigurationFactory
import org.junit.After
import org.junit.Assert.assertEquals
import org.junit.Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import io.realm.entities.PrimaryKeyClass
import io.realm.entities.SimpleClass
import io.realm.kotlin.createObject
import io.realm.kotlin.where
import io.realm.rule.TestRealmConfigurationFactory
import org.junit.After
import org.junit.Before
import org.junit.Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import org.junit.runners.Parameterized;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Random;
Expand All @@ -38,11 +36,9 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;

import io.realm.ManagedRealmListForValueTests;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import io.realm.RealmResults;
Expand All @@ -51,7 +47,7 @@
import io.realm.entities.NonLatinFieldNames;
import io.realm.log.LogLevel;
import io.realm.log.RealmLog;
import io.realm.rule.TestRealmConfigurationFactory;
import io.realm.TestRealmConfigurationFactory;
clementetb marked this conversation as resolved.
Show resolved Hide resolved

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import io.realm.exceptions.RealmPrimaryKeyConstraintException;
import io.realm.internal.modules.CompositeMediator;
import io.realm.internal.modules.FilterableMediator;
import io.realm.rule.TestRealmConfigurationFactory;

import static io.realm.internal.test.ExtraTests.assertArrayEquals;
import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import io.realm.entities.Cat;
import io.realm.internal.RealmProxyMediator;
import io.realm.rule.TestRealmConfigurationFactory;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotSame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -28,7 +29,6 @@
import io.realm.entities.realmname.ClassWithValueDefinedNames;
import io.realm.entities.realmname.CustomRealmNamesModule;
import io.realm.entities.realmname.FieldNameOverrideClassPolicy;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
package io.realm

import androidx.test.ext.junit.runners.AndroidJUnit4
import io.realm.DynamicRealm
import io.realm.TestHelper.TestLogger
import io.realm.entities.AllTypes
import io.realm.entities.Owner
import io.realm.internal.async.RealmThreadPoolExecutor
import io.realm.log.LogLevel
import io.realm.log.RealmLog
import io.realm.rule.BlockingLooperThread
import io.realm.rule.TestRealmConfigurationFactory
import org.junit.Before
import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import io.realm.entities.PrimaryKeyAsShort;
import io.realm.entities.PrimaryKeyAsString;
import io.realm.exceptions.RealmException;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
Expand All @@ -45,7 +46,6 @@
import io.realm.log.RealmLog;
import io.realm.rule.RunInLooperThread;
import io.realm.rule.RunTestInLooperThread;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -734,7 +734,7 @@ public void equalTo_noFieldObjectShouldThrow() {
dynamicRealm.commitTransaction();

thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("Invalid query: field 'nonExisting' not found in table 'NoField'.");
thrown.expectMessage("Illegal Argument: 'class_NoField' has no property: 'nonExisting'");
dynamicRealm.where(className).equalTo("nonExisting", 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.realm.entities.Dog;
import io.realm.rule.RunInLooperThread;
import io.realm.rule.RunTestInLooperThread;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import io.realm.entities.AllTypes;
import io.realm.entities.Dog;
import io.realm.rule.TestRealmConfigurationFactory;

import static junit.framework.TestCase.assertNotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.realm.entities.IOSChild;
import io.realm.internal.OsObjectStore;
import io.realm.internal.Table;
import io.realm.rule.TestRealmConfigurationFactory;

import static io.realm.internal.test.ExtraTests.assertArrayEquals;
import static org.junit.Assert.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import io.realm.entities.Owner;
import io.realm.rule.RunInLooperThread;
import io.realm.rule.RunTestInLooperThread;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import io.realm.internal.RealmProxyMediator;
import io.realm.rule.RunInLooperThread;
import io.realm.rule.RunTestInLooperThread;
import io.realm.rule.TestRealmConfigurationFactory;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down
Loading