Commit e92593e9 by Sarath Subramanian

ATLAS-1726 : Creating type name with space causes exceptions while doing DSL search

parent 928bbc5d
...@@ -82,7 +82,7 @@ public class DiscoveryREST { ...@@ -82,7 +82,7 @@ public class DiscoveryREST {
String queryStr = query == null ? "" : query; String queryStr = query == null ? "" : query;
if (StringUtils.isNoneEmpty(typeName)) { if (StringUtils.isNoneEmpty(typeName)) {
queryStr = typeName + " " + queryStr; queryStr = escapeTypeName(typeName) + " " + queryStr;
} }
if (StringUtils.isNoneEmpty(classification)) { if (StringUtils.isNoneEmpty(classification)) {
...@@ -207,4 +207,16 @@ public class DiscoveryREST { ...@@ -207,4 +207,16 @@ public class DiscoveryREST {
AtlasPerfTracer.log(perf); AtlasPerfTracer.log(perf);
} }
} }
private String escapeTypeName(String typeName) {
String ret;
if (StringUtils.startsWith(typeName, "`") && StringUtils.endsWith(typeName, "`")) {
ret = typeName;
} else {
ret = String.format("`%s`", typeName);
}
return ret;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment