[GitHub] [carbondata] QiangCai commented on a change in pull request #3882: [CARBONDATA-3941] Support binary data type reading from presto

2020-08-06 Thread GitBox


QiangCai commented on a change in pull request #3882:
URL: https://github.com/apache/carbondata/pull/3882#discussion_r466249308



##
File path: 
integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoTestNonTransactionalTableFiles.scala
##
@@ -176,24 +188,35 @@ class PrestoTestNonTransactionalTableFiles extends 
FunSuiteLike with BeforeAndAf
   def buildTestDataOtherDataType(rows: Int, sortColumns: Array[String]): Any = 
{
 val fields: Array[Field] = new Array[Field](5)
 // same column name, but name as boolean type
-fields(0) = new Field("name", DataTypes.BOOLEAN)
+fields(0) = new Field("name", DataTypes.VARCHAR)
 fields(1) = new Field("age", DataTypes.INT)
-fields(2) = new Field("id", DataTypes.BYTE)
+fields(2) = new Field("id", DataTypes.BINARY)
 fields(3) = new Field("height", DataTypes.DOUBLE)
 fields(4) = new Field("salary", DataTypes.FLOAT)
 
+val imagePath = "../../sdk/sdk/src/test/resources/image/carbondatalogo.jpg"
 try {
   val builder = CarbonWriter.builder()
   val writer =
 builder.outputPath(writerPath)
   
.uniqueIdentifier(System.currentTimeMillis()).withBlockSize(2).sortBy(sortColumns)
   .withCsvInput(new 
Schema(fields)).writtenBy("TestNonTransactionalCarbonTable").build()
   var i = 0
+  val bis = new BufferedInputStream(new FileInputStream(imagePath))
+  var hexValue: Array[Char] = null
+  val originBinary = new Array[Byte](bis.available)
+  while (bis.read(originBinary) != -1) {
+hexValue = Hex.encodeHex(originBinary)
+  }
+  bis.close()
+  val binaryValue = String.valueOf(hexValue)
+

Review comment:
   keep only one blank line.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [carbondata] QiangCai commented on a change in pull request #3882: [CARBONDATA-3941] Support binary data type reading from presto

2020-08-06 Thread GitBox


QiangCai commented on a change in pull request #3882:
URL: https://github.com/apache/carbondata/pull/3882#discussion_r466249621



##
File path: 
integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoTestNonTransactionalTableFiles.scala
##
@@ -176,24 +188,35 @@ class PrestoTestNonTransactionalTableFiles extends 
FunSuiteLike with BeforeAndAf
   def buildTestDataOtherDataType(rows: Int, sortColumns: Array[String]): Any = 
{
 val fields: Array[Field] = new Array[Field](5)
 // same column name, but name as boolean type
-fields(0) = new Field("name", DataTypes.BOOLEAN)
+fields(0) = new Field("name", DataTypes.VARCHAR)
 fields(1) = new Field("age", DataTypes.INT)
-fields(2) = new Field("id", DataTypes.BYTE)
+fields(2) = new Field("id", DataTypes.BINARY)
 fields(3) = new Field("height", DataTypes.DOUBLE)
 fields(4) = new Field("salary", DataTypes.FLOAT)
 
+val imagePath = "../../sdk/sdk/src/test/resources/image/carbondatalogo.jpg"

Review comment:
   better to base on rootPath
   val imagePath = 
"$rootPath/sdk/sdk/src/test/resources/image/carbondatalogo.jpg"
   
   another question: why presto module need scala?





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org