gemini-code-assist[bot] commented on code in PR #37277:
URL: https://github.com/apache/beam/pull/37277#discussion_r2678756545
##########
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java:
##########
@@ -416,6 +418,10 @@ static Object toBeamObject(Object value, FieldType
fieldType, boolean verifyValu
String identifier = logicalType.getIdentifier();
if (TimeWithLocalTzType.IDENTIFIER.equals(identifier)) {
return Instant.ofEpochMilli(((Number) value).longValue());
+ } else if (MicrosInstant.IDENTIFIER.equals(identifier)
+ || NanosInstant.IDENTIFIER.equals(identifier)) {
Review Comment:

This condition is repeated three times in this file (here, and in the
`getBeamField` and `toCalciteValue` methods). To improve readability and reduce
duplication, consider extracting it into a private static helper method in
`BeamCalcRel`:
```java
private static boolean isPortableInstantIdentifier(String identifier) {
return MicrosInstant.IDENTIFIER.equals(identifier) ||
NanosInstant.IDENTIFIER.equals(identifier);
}
```
This helper can then be used in all three places.
--
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]