imbajin commented on code in PR #3289:
URL: https://github.com/apache/hugegraph/pull/3289#discussion_r4219118687
##########
hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/opencypher/CypherOpProcessor.java:
##########
@@ -102,12 +106,74 @@ public class CypherOpProcessor extends
AbstractEvalOpProcessor {
private static final String DEFAULT_TRANSLATOR_DEFINITION =
"gremlin+cfog_server_extensions+inline_parameters";
+ // translation 1.0.4 uses this string as null and cannot preserve it as
bound data.
+ private static final String RESERVED_NULL_VALUE = " cypher.null";
+
private static final Logger logger = getLogger(CypherOpProcessor.class);
public CypherOpProcessor() {
super(true);
}
+ @Override
+ protected Optional<ThrowingConsumer<Context>>
validateEvalMessage(RequestMessage message)
+ throws OpProcessorException {
+ Object query = message.getArgs().get(Tokens.ARGS_GREMLIN);
+ String error = null;
+ if (!(query instanceof String) || ((String) query).isBlank()) {
+ error = "The Cypher query must be a nonblank string";
+ } else if (message.getArgs().containsKey(Tokens.ARGS_BINDINGS)) {
+ Object supplied = message.getArgs().get(Tokens.ARGS_BINDINGS);
+ if (!(supplied instanceof Map)) {
+ error = "Cypher bindings must be a map";
+ } else {
+ Map<?, ?> bindings = (Map<?, ?>) supplied;
+ if (bindings.size() > this.maxParameters) {
Review Comment:
Clarified this as a fixed limit of 16 top-level parameters and stated that
this Cypher processor does not support a maxParameters setting. A Map counts as
one parameter. Live verification confirmed that a single Map with 17 entries
works with explicit field references, and native REST readback matched all 17
persisted values; 17 separate top-level bindings were rejected.
The suggested shorthand CREATE (n:label $props) did not assign the
primary-key property with translation 1.0.4, so the documentation uses explicit
property references such as CREATE (n:person {name:$props.name, age:$props.age,
city:$props.city}) instead. The branch has also been rebased onto latest Apache
master (1.8.0); clean compile, installation and the affected unit/API
regressions passed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]