Skip to content

Commit

Permalink
🐛 Fixed TigerGraph Null Value Bug (#125)
Browse files Browse the repository at this point in the history
* Added getNonExistentVertexByProperty tests

* Fixed tigergraph bug
  • Loading branch information
DavidBakerEffendi authored Mar 19, 2021
1 parent cbf101f commit dc19979
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.3.7] - [Unreleased]

### Fixed
- `TigerGraphDriver` bug where empty strings for intentional properties would be unintentionally excluded.
- `Member.name` and `FieldIdentifier.code` properly handled

## [0.3.6] - 2021-03-18

### Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.6
0.3.7
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ class TigerGraphDriver internal constructor() : IOverridenIdDriver, ISchemaSafeD

private fun vertexPayloadToNode(o: JSONObject): NewNodeBuilder {
val attributes = o["attributes"] as JSONObject
val vertexMap = HashMap<String, Any>()
attributes.keySet().filter { attributes[it] != "" }
val vertexMap = mutableMapOf<String, Any>()
attributes.keySet()
.map {
if (it == "id") Pair(it, attributes[it].toString().toLong())
else Pair(it.removePrefix("_"), attributes[it])
Expand Down Expand Up @@ -556,7 +556,7 @@ class TigerGraphDriver internal constructor() : IOverridenIdDriver, ISchemaSafeD
)
val codeControl = CodeControl()
runCatching {
logger.debug("Posting payload \"${payload.replace("\\s".toRegex(), " ").subSequence(0, 40)}...\"")
logger.debug("Posting payload:\n$payload")
codeControl.disableSystemExit()
val output = executeGsqlClient(args)
logger.debug(output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ class JanusGraphDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -669,6 +669,14 @@ class JanusGraphDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ class Neo4jDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -661,6 +661,14 @@ class Neo4jDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ class NeptuneDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -691,6 +691,14 @@ class NeptuneDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class OverflowDbDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -670,6 +670,14 @@ class OverflowDbDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class TigerGraphDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -701,6 +701,14 @@ class TigerGraphDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ class TinkerGraphDriverIntTest {
}

@Test
fun testGetNoneExistentProperty() {
fun testGetNonExistentProperty() {
assertEquals(emptyList<String>(), driver.getPropertyFromVertices<String>("<dne>"))
}

Expand All @@ -721,6 +721,14 @@ class TinkerGraphDriverIntTest {
assertTrue(driver.getVerticesByProperty(FULL_NAME, STRING_1, TYPE_DECL).size == 1)
}

@Test
fun getNonExistentVertexByProperty() {
val r1 = driver.getVerticesByProperty(FULL_NAME, "<dne>")
assertTrue(r1.isEmpty())
val r2 = driver.getVerticesByProperty(FULL_NAME, "<dne>", NAMESPACE_BLOCK)
assertTrue(r2.isEmpty())
}

@Test
fun getVertexByIsExternalAndType() {
val r = driver.getVerticesByProperty(IS_EXTERNAL, BOOL_1)
Expand Down

0 comments on commit dc19979

Please sign in to comment.