This is an automated email from the ASF dual-hosted git repository.
yhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 107a558a2c9 Support portable decimal types for Beam SQL (#36713)
107a558a2c9 is described below
commit 107a558a2c9fbacfe7dd012c2a43656867df9bed
Author: Yi Hu <[email protected]>
AuthorDate: Tue Nov 4 14:47:20 2025 -0500
Support portable decimal types for Beam SQL (#36713)
---
.../org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
index 5c6534f2dc2..044e7557439 100644
---
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
+++
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
@@ -54,6 +54,7 @@ import org.apache.beam.sdk.schemas.FieldAccessDescriptor;
import org.apache.beam.sdk.schemas.Schema;
import org.apache.beam.sdk.schemas.Schema.LogicalType;
import org.apache.beam.sdk.schemas.logicaltypes.FixedBytes;
+import org.apache.beam.sdk.schemas.logicaltypes.FixedPrecisionNumeric;
import org.apache.beam.sdk.schemas.logicaltypes.FixedString;
import org.apache.beam.sdk.schemas.logicaltypes.PassThroughLogicalType;
import org.apache.beam.sdk.schemas.logicaltypes.SqlTypes;
@@ -600,6 +601,8 @@ public class BeamCalcRel extends AbstractBeamCalcRel {
fieldName,
Expressions.constant(LocalDateTime.class)),
LocalDateTime.class);
+ } else if (FixedPrecisionNumeric.IDENTIFIER.equals(identifier)) {
+ value = Expressions.call(expression, "getDecimal", fieldName);
} else {
throw new UnsupportedOperationException("Unable to get logical
type " + identifier);
}
@@ -687,6 +690,8 @@ public class BeamCalcRel extends AbstractBeamCalcRel {
Expressions.multiply(dateValue,
Expressions.constant(MILLIS_PER_DAY)),
Expressions.divide(timeValue,
Expressions.constant(NANOS_PER_MILLISECOND)));
return nullOr(value, returnValue);
+ } else if (FixedPrecisionNumeric.IDENTIFIER.equals(identifier)) {
+ return Expressions.convert_(value, BigDecimal.class);
} else {
throw new UnsupportedOperationException("Unable to convert logical
type " + identifier);
}