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

fix: support null value for gremlin test #2061

Merged
merged 9 commits into from
Jan 16, 2023

Conversation

z7658329
Copy link
Member

@z7658329 z7658329 commented Dec 27, 2022

fix sub-issue 4 #2058

@z7658329 z7658329 changed the title support null value fix TinkerPop unit test : support null value Dec 27, 2022
@imbajin imbajin changed the title fix TinkerPop unit test : support null value fix: support null value for gremlin test Dec 27, 2022
@imbajin
Copy link
Member

imbajin commented Dec 27, 2022

image

should handle the correspond tests together

@z7658329
Copy link
Member Author

image

should handle the correspond tests together

ok

@@ -430,9 +430,6 @@ public static final ElementKeys classifyKeys(Object... keyValues) {
throw Element.Exceptions
.providedKeyValuesMustHaveALegalKeyOnEvenIndices();
}
if (val == null) {
throw Property.Exceptions.propertyDoesNotExist();
Copy link
Contributor

Choose a reason for hiding this comment

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

seems need to skip the null value here with continue, also add the comment for why


this.owner = owner;
this.pkey = pkey;
this.value = pkey.validValueOrThrow(value);
this.value = pkey.validValue(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

we can keep the origin code if the null value is skipped?


this.owner = owner;
this.pkey = pkey;
this.value = pkey.validValueOrThrow(value);
this.value = pkey.validValue(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

note also need to update HugeEdge.property(String key, V value) to add null value check (the same as HugeVertex.property(String key, V value)):

        if (value == null) {
            this.removeProperty(propertyKey.id());
            return EmptyProperty.instance();
        }

@imbajin imbajin self-assigned this Dec 30, 2022
@imbajin imbajin added bug Something isn't working ci-cd Build or deploy labels Dec 30, 2022
@imbajin imbajin added this to the 1.0.0 milestone Dec 30, 2022
@codecov
Copy link

codecov bot commented Dec 30, 2022

Codecov Report

Merging #2061 (cba6559) into master (f49b2b8) will decrease coverage by 0.67%.
The diff coverage is 35.29%.

@@             Coverage Diff              @@
##             master    #2061      +/-   ##
============================================
- Coverage     68.67%   68.00%   -0.68%     
+ Complexity      979      676     -303     
============================================
  Files           479      479              
  Lines         39652    39655       +3     
  Branches       5576     5577       +1     
============================================
- Hits          27231    26967     -264     
- Misses         9778    10045     +267     
  Partials       2643     2643              
Impacted Files Coverage Δ
.../java/org/apache/hugegraph/schema/PropertyKey.java 76.97% <ø> (ø)
...va/org/apache/hugegraph/structure/HugeElement.java 73.63% <0.00%> (+0.33%) ⬆️
.../java/org/apache/hugegraph/structure/HugeEdge.java 75.66% <16.66%> (-0.68%) ⬇️
...ava/org/apache/hugegraph/structure/HugeVertex.java 78.67% <50.00%> (-0.84%) ⬇️
...a/org/apache/hugegraph/structure/HugeProperty.java 45.83% <100.00%> (-2.17%) ⬇️
...raph/backend/store/postgresql/PostgresqlStore.java 0.00% <0.00%> (-100.00%) ⬇️
...raph/backend/store/postgresql/PostgresqlTable.java 0.00% <0.00%> (-97.11%) ⬇️
...kend/store/postgresql/PostgresqlStoreProvider.java 0.00% <0.00%> (-94.92%) ⬇️
...aph/backend/store/postgresql/PostgresqlTables.java 0.00% <0.00%> (-87.37%) ⬇️
...backend/store/postgresql/PostgresqlSerializer.java 0.00% <0.00%> (-80.00%) ⬇️
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -202,6 +204,11 @@ public <V> Property<V> property(String key, V value) {
E.checkArgument(this.label.properties().contains(propertyKey.id()),
"Invalid property '%s' for edge label '%s'",
key, this.label());
if (value == null) {
this.removeProperty(propertyKey.id());
Copy link
Member Author

Choose a reason for hiding this comment

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

if remove null value's property, may cause tinkerpop ut failed ?

Copy link
Member

@imbajin imbajin Dec 30, 2022

Choose a reason for hiding this comment

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

follow the tinkerpop ci action tests with release-1.0.0

@imbajin
Copy link
Member

imbajin commented Dec 30, 2022

gremlin test still failed in:
image

g.V(new Object[0]).hasLabel("person", new String[0]).property("name", (Object)null, new Object[0]);

fix it in release-1.0.0 branch now

@@ -364,6 +369,7 @@ public void vertices(HugeVertex owner, HugeVertex other) {
if (ownerLabel.equals(this.label.sourceLabel())) {
this.vertices(true, owner, other);
} else {
// TODO: why when compare the label but ignore the result?
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe missing assert

@@ -202,6 +204,11 @@ public <V> Property<V> property(String key, V value) {
E.checkArgument(this.label.properties().contains(propertyKey.id()),
"Invalid property '%s' for edge label '%s'",
key, this.label());
if (value == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

also update HugeVertex.property(String key, V value)

zyxxoo
zyxxoo previously approved these changes Jan 14, 2023
@javeme
Copy link
Contributor

javeme commented Jan 14, 2023

@imbajin please cherry pick changes from the release branch?

@imbajin
Copy link
Member

imbajin commented Jan 14, 2023

@imbajin please cherry pick changes from the release branch?

I'm on it, soon

Update: done

@imbajin imbajin merged commit 91a616b into apache:master Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci-cd Build or deploy
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants