[ 
https://issues.apache.org/jira/browse/TINKERPOP-3153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18077666#comment-18077666
 ] 

ASF GitHub Bot commented on TINKERPOP-3153:
-------------------------------------------

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.





> 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)

Reply via email to