kenhuuu commented on code in PR #3401:
URL: https://github.com/apache/tinkerpop/pull/3401#discussion_r3173647744
##########
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/translator/GoTranslateVisitor.java:
##########
@@ -346,6 +347,35 @@ public Void visitUuidLiteral(final
GremlinParser.UuidLiteralContext ctx) {
return null;
}
+ @Override
+ public Void visitCharacterLiteral(final
GremlinParser.CharacterLiteralContext ctx) {
+ throw new TranslatorException("Character literals are not supported in
Go");
+ }
+
+ @Override
+ public Void visitDurationLiteral(final
GremlinParser.DurationLiteralContext ctx) {
+ final long seconds = Long.parseLong(ctx.integerLiteral(0).getText());
+ final int nanos = Integer.parseInt(ctx.integerLiteral(1).getText());
+ final boolean isPositive = ctx.booleanLiteral() == null ||
+ Boolean.parseBoolean(ctx.booleanLiteral().getText());
+ final long totalNanos = seconds * 1_000_000_000L + nanos;
Review Comment:
This shouldn't be necessary as Long is sufficient for Java. The reason this
is needed for TypeScript is because numbers are stored as floats so there is a
`Number.MAX_SAFE_INTEGER` which will likely get exceeded in this
multiplication. That makes BigInt safer for the TypeScript version.
--
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]