-
Notifications
You must be signed in to change notification settings - Fork 528
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: Char covert to String on remove specified unicode #1664
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1664 +/- ##
============================================
+ Coverage 66.56% 66.97% +0.40%
- Complexity 7039 7068 +29
============================================
Files 421 421
Lines 34673 34675 +2
Branches 4803 4803
============================================
+ Hits 23081 23223 +142
+ Misses 9247 9107 -140
Partials 2345 2345
Continue to review full report at Codecov.
|
1779753
to
0f4f1eb
Compare
} | ||
|
||
// Ignore unicode \u0000 to \u0003 | ||
words.removeAll(IGNORE_SYM_SET); |
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.
can add a test case?
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.
ok
@@ -8582,6 +8582,29 @@ public void testQueryByHasIdEmptyListInPage() { | |||
Assert.assertNull(page); | |||
} | |||
|
|||
@Test | |||
public void testIgnoreSymbol() { |
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.
rename to test testQueryBySearchIndexWithSpecialSymbol
@@ -103,6 +103,15 @@ | |||
public static final String INDEX_SYM_NULL = "\u0001"; | |||
public static final String INDEX_SYM_EMPTY = "\u0002"; | |||
public static final char INDEX_SYM_MAX = '\u0003'; | |||
public static final Set<String> IGNORE_SYM_SET; |
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.
add fixed #1638
to commit message
.by("name").search().ifNotExist().create(); | ||
|
||
Vertex vertex = graph.addVertex(T.label, "person", "name", | ||
"xyz\u0000abc", "city", "Hongkong", |
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.
also test \u0003
|
||
Vertex vertex = graph.addVertex(T.label, "person", "name", | ||
"xyz\u0000abc", "city", "Hongkong", | ||
"age", 15); |
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.
what's the behavior if adding a vertex with "name": "\u0000"
0a0d5ad
to
e22ccd4
Compare
LGTM |
postgresql ci failed Error: testQueryBySearchIndexWithSpecialSymbol(com.baidu.hugegraph.core.VertexCoreTest) Time elapsed: 0.304 s <<< ERROR!
com.baidu.hugegraph.backend.BackendException: Failed to commit
at com.baidu.hugegraph.core.VertexCoreTest.testQueryBySearchIndexWithSpecialSymbol(VertexCoreTest.java:8604)
Caused by: java.sql.BatchUpdateException: Batch entry 0 INSERT INTO g_ai (FIELD_VALUES, INDEX_LABEL_ID, ELEMENT_IDS, EXPIRED_TIME) VALUES ('xyz', 276, 'S1454:xyzS1454:xyzabc', 0) ON CONFLICT (FIELD_VALUES, INDEX_LABEL_ID, ELEMENT_IDS) DO UPDATE SET FIELD_VALUES = 'xyz', INDEX_LABEL_ID = 276, ELEMENT_IDS = 'S1454:xyzS1454:xyzabc', EXPIRED_TIME = 0 was aborted: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Call getNextException to see other errors in the batch.
at com.baidu.hugegraph.core.VertexCoreTest.testQueryBySearchIndexWithSpecialSymbol(VertexCoreTest.java:8604)
Caused by: org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x00
at com.baidu.hugegraph.core.VertexCoreTest.testQueryBySearchIndexWithSpecialSymbol(VertexCoreTest.java:8604) |
048751e
to
df41dd0
Compare
e21a453
to
e5cc8c1
Compare
@@ -8590,10 +8590,10 @@ public void testQueryBySearchIndexWithSpecialSymbol() { | |||
.by("name").search().ifNotExist().create(); | |||
|
|||
Vertex vertex = graph.addVertex(T.label, "person", "name", | |||
"xyz\u0000abc", "city", "Hongkong", | |||
"xyz\u0002abc", "city", "Hongkong", |
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.
also add case for "xyz\u0001abc"
"age", 15); | ||
Vertex vertex2 = graph.addVertex(T.label, "person", "name", | ||
"\u0000", "city", "Hongkong", | ||
"\u0002", "city", "Hongkong", |
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.
also add case for "\u0001"
e5cc8c1
to
5111d0a
Compare
ci failed
|
need to rebase master |
5111d0a
to
fc6b4e3
Compare
@@ -61,6 +61,15 @@ | |||
public static final String INDEX_VALUE_NULL = new String("<null>"); | |||
public static final String INDEX_VALUE_EMPTY = new String("<empty>"); | |||
|
|||
public static final Set<String> IGNORE_SYM_SET; | |||
static { | |||
List<String> list = new ArrayList<>(INDEX_SYM_MIN - INDEX_SYM_MAX); |
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.
error Illegal Capacity: -3
, expect INDEX_SYM_MAX - INDEX_SYM_MIN
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.
ok
fixed #1638