Skip to content

Commit

Permalink
Issue 187 Fix compilation error in generated code for fixed type.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Etherington committed Dec 12, 2023
1 parent a1fa7ac commit cebbaa0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ object JavaConverter {
case Schema.Type.FIXED => schema.getLogicalType match {
case decimal: LogicalTypes.Decimal => {
val Decimal = RootClass.newClass("org.apache.avro.LogicalTypes.Decimal")
val scale = tree.DOT("bytes").DOT("setScale").APPLY(REF("scale"))
val scale = tree.DOT("bigDecimal").DOT("setScale").APPLY(REF("scale"))
def scaleAndRound(roundingMode: BigDecimal.RoundingMode.Value) =
tree.DOT("bigDecimal").DOT("setScale").APPLY(REF("scale"), REF("BigDecimal.RoundingMode."+ roundingMode.toString))
Block(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final case class LogicalSc(var data: BigDecimal, var fxField: fxType, var ts: ja
val schema = getSchema.getFields().get(field$).schema()
val decimalType = schema.getLogicalType().asInstanceOf[org.apache.avro.LogicalTypes.Decimal]
val scale = decimalType.getScale()
val scaledValue = fxField.bytes.setScale(scale)
val scaledValue = fxField.bigDecimal.setScale(scale)
val bigDecimal = scaledValue.bigDecimal
LogicalSc.decimalConversion.toFixed(bigDecimal, schema, decimalType)
}.asInstanceOf[AnyRef]
Expand Down

0 comments on commit cebbaa0

Please sign in to comment.