Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Temporal formatted expression bug #596

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/translate/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2876,9 +2876,14 @@ const buildNeo4jTypeTranslation = ({
nullFieldPredicate = `${listVariable}.${filterName} IS NULL OR `;
}
if (isTemporalFormatted) {
return `(${nullFieldPredicate}${propertyPath} = ${cypherTypeConstructor}(${listVariable}.${filterName}))`;
return `(${nullFieldPredicate}${operatorExpression} ${cypherTypeConstructor}(${listVariable}.${filterName}))`;
} else {
return `(${nullFieldPredicate}${propertyPath}.${filterName} = ${listVariable}.${filterName})`;
let filterNameOprType = buildOperatorExpression({
filterOperationType: filterOperationType,
propertyPath: '',
isListFilterArgument: false
});
return `(${nullFieldPredicate}${propertyPath}.${filterName} ${filterNameOprType} ${listVariable}.${filterName})`;
}
}
);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/cypherTest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7667,7 +7667,7 @@ test('Query node using only formatted temporal filter value nested in logical OR
}
}
`,
expectedCypherQuery = `MATCH (\`temporalNode\`:\`TemporalNode\`) WHERE (ANY(_OR IN $filter.OR WHERE (((_OR.datetime_gte.formatted IS NULL OR \`temporalNode\`.datetime = datetime(_OR.datetime_gte.formatted)))))) RETURN \`temporalNode\` {_id: ID(\`temporalNode\`),datetime: { year: \`temporalNode\`.datetime.year , month: \`temporalNode\`.datetime.month , day: \`temporalNode\`.datetime.day , hour: \`temporalNode\`.datetime.hour , minute: \`temporalNode\`.datetime.minute , second: \`temporalNode\`.datetime.second , millisecond: \`temporalNode\`.datetime.millisecond , microsecond: \`temporalNode\`.datetime.microsecond , nanosecond: \`temporalNode\`.datetime.nanosecond , timezone: \`temporalNode\`.datetime.timezone , formatted: toString(\`temporalNode\`.datetime) }} AS \`temporalNode\``,
expectedCypherQuery = `MATCH (\`temporalNode\`:\`TemporalNode\`) WHERE (ANY(_OR IN $filter.OR WHERE (((_OR.datetime_gte.formatted IS NULL OR \`temporalNode\`.datetime >= datetime(_OR.datetime_gte.formatted)))))) RETURN \`temporalNode\` {_id: ID(\`temporalNode\`),datetime: { year: \`temporalNode\`.datetime.year , month: \`temporalNode\`.datetime.month , day: \`temporalNode\`.datetime.day , hour: \`temporalNode\`.datetime.hour , minute: \`temporalNode\`.datetime.minute , second: \`temporalNode\`.datetime.second , millisecond: \`temporalNode\`.datetime.millisecond , microsecond: \`temporalNode\`.datetime.microsecond , nanosecond: \`temporalNode\`.datetime.nanosecond , timezone: \`temporalNode\`.datetime.timezone , formatted: toString(\`temporalNode\`.datetime) }} AS \`temporalNode\``,
expectedParams = {
offset: 0,
first: -1,
Expand Down