Github user KanakaKumar commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2687#discussion_r216123042
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestNonTransactionalCarbonTableWithAvroDataType.scala
 ---
    @@ -728,14 +748,46 @@ class TestNonTransactionalCarbonTableWithAvroDataType 
extends QueryTest with Bef
             |]}
           """.stripMargin
     
    -    val json1 = """ {"name":"bob", "age":10.24, "address" : 
{"street":"abc", "city":"32"}} """
    -
         val nn = new org.apache.avro.Schema.Parser().parse(schema1)
    +
    +    val logicalType = LogicalTypes.decimal(4, 2)
    +    val decimal1 = new java.math.BigDecimal("32").setScale(2)
    +    //get unscaled 2's complement bytearray
    +    val bytes =
    +      decimalConversion.toBytes(decimal1, nn.getField("address").schema, 
logicalType)
    +    val data = DatatypeConverter.printBase64Binary(bytes.array())
    +    val json1 = s""" {"name":"bob", "age":10.24, "address" : 
{"street":"abc", "city":"$data"}} """
         val record = testUtil.jsonToAvro(json1, schema1)
     
    +    val jsonData = new 
String(record.get(2).asInstanceOf[GenericData.Record].get(1)
    +      .asInstanceOf[ByteBuffer].array(),
    +      CarbonCommonConstants.DEFAULT_CHARSET_CLASS)
    +    val bytesValue = 
ByteBuffer.wrap(DatatypeConverter.parseBase64Binary(jsonData))
    +    val mySchema =
    +      """
    +        |{"name": "address",
    +        | "type": "record",
    +        | "fields": [
    +        |  { "name": "street", "type": "string"},
    +        |  { "name": "city", "type": {"type" : "bytes",
    --- End diff --
    
    city and decimal is not correct example


---

Reply via email to