You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2019/11/05 20:03:11 UTC
[atlas] 01/02:
ATLAS-3504-DSL-query-with-like-clause-returns-unexpected-results-v1.patch
This is an automated email from the ASF dual-hosted git repository.
amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git
commit f6e252f8bba84da7f46f69c5fe264e6d48eec017
Author: nikhilbonte <ni...@freestoneinfotech.com>
AuthorDate: Tue Nov 5 15:28:51 2019 +0530
ATLAS-3504-DSL-query-with-like-clause-returns-unexpected-results-v1.patch
Signed-off-by: Ashutosh Mestry <am...@hortonworks.com>
---
.../src/main/java/org/janusgraph/diskstorage/solr/Solr6Index.java | 7 +++++++
.../src/test/java/org/apache/atlas/query/DSLQueriesTest.java | 8 ++++++++
2 files changed, 15 insertions(+)
diff --git a/graphdb/janus/src/main/java/org/janusgraph/diskstorage/solr/Solr6Index.java b/graphdb/janus/src/main/java/org/janusgraph/diskstorage/solr/Solr6Index.java
index a272ab9..d0d7fd7 100644
--- a/graphdb/janus/src/main/java/org/janusgraph/diskstorage/solr/Solr6Index.java
+++ b/graphdb/janus/src/main/java/org/janusgraph/diskstorage/solr/Solr6Index.java
@@ -24,6 +24,8 @@ import java.io.IOException;
import java.io.StringReader;
import java.io.UncheckedIOException;
import java.lang.reflect.Constructor;
+import java.math.BigDecimal;
+import java.math.BigInteger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Instant;
@@ -1077,6 +1079,10 @@ public class Solr6Index implements IndexProvider {
} else if (AttributeUtil.isDecimal(dataType)) {
if (dataType.equals(Float.class)) postfix = "_f";
else postfix = "_d";
+ } else if (dataType.equals(BigInteger.class)) {
+ postfix = "_bi";
+ } else if (dataType.equals(BigDecimal.class)) {
+ postfix = "_bd";
} else if (dataType.equals(Geoshape.class)) {
postfix = "_g";
} else if (dataType.equals(Date.class) || dataType.equals(Instant.class)) {
@@ -1086,6 +1092,7 @@ public class Solr6Index implements IndexProvider {
} else if (dataType.equals(UUID.class)) {
postfix = "_uuid";
} else throw new IllegalArgumentException("Unsupported data type ["+dataType+"] for field: " + key);
+
if (keyInfo.getCardinality() == Cardinality.SET || keyInfo.getCardinality() == Cardinality.LIST) {
postfix += "s";
}
diff --git a/repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java b/repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java
index 36ec3d2..724ae9f 100644
--- a/repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java
+++ b/repository/src/test/java/org/apache/atlas/query/DSLQueriesTest.java
@@ -134,6 +134,14 @@ public class DSLQueriesTest extends BasicTestSetup {
@DataProvider(name = "comparisonQueriesProvider")
private Object[][] comparisonQueriesProvider() {
return new Object[][] {
+ {"Person where (name = \"Julius\" )", 1},
+ {"Person where (name like \"Jul*\" )", 1},
+ {"Person where (name like \"J*\" )", 3},
+ {"Person where (name like \"*us\" )", 1},
+ {"Person where (name like \"*uli*\" )", 1},
+ {"Person where (name like \"Julius\" )", 1},
+ {"Person where (name like \"Jul\" )", 0},
+
{"Person where (birthday < \"1950-01-01T02:35:58.440Z\" )", 0},
{"Person where (birthday > \"1975-01-01T02:35:58.440Z\" )", 2},
{"Person where (birthday >= \"1975-01-01T02:35:58.440Z\" )", 2},