akkio-97 commented on a change in pull request #3773:
URL: https://github.com/apache/carbondata/pull/3773#discussion_r466927976



##########
File path: 
integration/presto/src/test/scala/org/apache/carbondata/presto/integrationtest/PrestoReadTableFilesTest.scala
##########
@@ -0,0 +1,443 @@
+package org.apache.carbondata.presto.integrationtest
+
+import java.io.File
+import java.sql.{SQLException, Timestamp}
+import java.util
+import java.util.Arrays.asList
+
+import io.prestosql.jdbc.PrestoArray
+import org.apache.carbondata.common.logging.LogServiceFactory
+import org.apache.carbondata.core.constants.CarbonCommonConstants
+import org.apache.carbondata.core.datastore.filesystem.CarbonFile
+import org.apache.carbondata.core.datastore.impl.FileFactory
+import org.apache.carbondata.core.metadata.datatype.{DataTypes, Field}
+import org.apache.carbondata.core.util.{CarbonProperties, CarbonUtil}
+import org.apache.carbondata.presto.server.PrestoServer
+import org.apache.carbondata.sdk.file.{CarbonWriter, Schema}
+import org.apache.commons.io.FileUtils
+import org.apache.commons.lang.RandomStringUtils
+import org.apache.spark.sql.Row
+import org.scalatest.{BeforeAndAfterAll, FunSuiteLike, BeforeAndAfterEach}
+
+import scala.collection.mutable
+import scala.collection.JavaConverters._
+class PrestoReadTableFilesTest extends FunSuiteLike with BeforeAndAfterAll 
with BeforeAndAfterEach{
+  private val logger = LogServiceFactory
+    
.getLogService(classOf[PrestoTestNonTransactionalTableFiles].getCanonicalName)
+
+  private val rootPath = new File(this.getClass.getResource("/").getPath
+    + "../../../..").getCanonicalPath
+  private val storePath = s"$rootPath/integration/presto/target/store"
+  private val systemPath = s"$rootPath/integration/presto/target/system"
+  private var writerPath = storePath + "/sdk_output/files"
+  private val prestoServer = new PrestoServer
+  private var varcharString = new String
+
+  override def beforeAll: Unit = {
+    
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_WRITTEN_BY_APPNAME,
+      "Presto")
+    
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_WRITTEN_BY_APPNAME,
+      "Presto")
+    val map = new util.HashMap[String, String]()
+    map.put("hive.metastore", "file")
+    map.put("hive.metastore.catalog.dir", s"file://$storePath")
+
+    prestoServer.startServer("sdk_output", map)
+  }
+
+  override def afterAll(): Unit = {
+    prestoServer.stopServer()
+    CarbonUtil.deleteFoldersAndFiles(FileFactory.getCarbonFile(storePath))
+  }
+
+  private def createComplexTableForSingleLevelArray = {
+    prestoServer.execute("drop table if exists sdk_output.files")
+    prestoServer.execute("drop schema if exists sdk_output")
+    prestoServer.execute("create schema sdk_output")
+    prestoServer
+      .execute(
+        "create table sdk_output.files(stringCol varchar, intCol int, 
doubleCol double, realCol real, boolCol boolean, arrayStringCol1 
array(varchar), arrayStringcol2 array(varchar), arrayIntCol array(int), 
arrayBigIntCol array(bigint), arrayRealCol array(real), arrayDoubleCol 
array(double), arrayBooleanCol array(boolean)) with(format='CARBON') ")
+  }
+
+  private def createComplexTableFor2LevelArray = {
+    prestoServer.execute("drop table if exists sdk_output.files2")
+    prestoServer.execute("drop schema if exists sdk_output")
+    prestoServer.execute("create schema sdk_output")
+        prestoServer
+      .execute(
+        "create table sdk_output.files2(arrayArrayInt array(array(int)), 
arrayArrayBigInt array(array(bigint)), arrayArrayReal array(array(real)), 
arrayArrayDouble array(array(double)), arrayArrayString array(array(varchar)), 
arrayArrayBoolean array(array(boolean))) with(format='CARBON') ")
+  }
+
+  private def createComplexTableFor3LevelArray = {
+    prestoServer.execute("drop table if exists sdk_output.files3")
+    prestoServer.execute("drop schema if exists sdk_output")
+    prestoServer.execute("create schema sdk_output")
+    prestoServer
+        .execute(
+          "create table sdk_output.files3(array3_Int array(array(array(int))), 
array3_BigInt array(array(array(bigint))), array3_Real 
array(array(array(real))), array3_Double array(array(array(double))), 
array3_String array(array(array(varchar))), array3_Boolean 
array(array(array(boolean))) ) with(format='CARBON') ")
+    }
+
+  def buildComplexTestForSingleLevelArray(): Any = {
+    FileUtils.deleteDirectory(new File(writerPath))
+    createComplexTableForSingleLevelArray
+    import java.io.IOException
+    val source = new File(this.getClass.getResource("/").getPath + "../../" + 
"/temp/table1").getCanonicalPath
+    val srcDir = new File(source)
+    val destination = new File(this.getClass.getResource("/").getPath + 
"../../" + "/target/store/sdk_output/files/").getCanonicalPath
+    val destDir = new File(destination)
+    try FileUtils.copyDirectory(srcDir, destDir)
+    catch {
+      case e: IOException =>
+        e.printStackTrace()
+    }
+  }
+
+  def buildComplexTestFor2LevelArray(): Any = {
+    writerPath = storePath + "/sdk_output/files2"

Review comment:
       done




----------------------------------------------------------------
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:
[email protected]


Reply via email to