[
https://issues.apache.org/jira/browse/TINKERPOP-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077463#comment-18077463
]
ASF GitHub Bot commented on TINKERPOP-3153:
-------------------------------------------
xiazcy commented on code in PR #3401:
URL: https://github.com/apache/tinkerpop/pull/3401#discussion_r3171365907
##########
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:
Looks like you used BigInt in the JS translator for Go, i.e.:
> // Use BigInt to avoid precision loss for durations over ~104 days
> const totalNanos = BigInt(seconds) * 1_000_000_000n +
BigInt(nanos);
Should the Java translator here also use BigInt for the same reason?
> Expand type syntax in grammar in 4.0
> ------------------------------------
>
> Key: TINKERPOP-3153
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3153
> Project: TinkerPop
> Issue Type: Improvement
> Affects Versions: 4.0.0
> Reporter: Ken Hu
> Priority: Major
>
> Types to add to the grammar in 4.0:
> * Char
> ** Unfortunately '' is already used for strings to match Groovy. Will need
> to look into something nice for this.
> * Duration
> ** Should check to see if Duration can be used for date functions as well
> ** Duration(Long)
> * CompositePdt
> ** Pdt("name", [ : ] )
> * PrimitivePdt
> ** Pdt("name", "value")
> * Tree
> * Graph
> * Binary (ByteBuffer) - moved from 3.8.0
> ** {{Binary( '/9j/4AAQSkZJRgABAQEAAAAAAAD/==')}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)