You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by gv...@apache.org on 2017/03/16 09:28:46 UTC
[03/14] incubator-carbondata git commit: added rename table
functionality to alter table
added rename table functionality to alter table
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/df00163a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/df00163a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/df00163a
Branch: refs/heads/master
Commit: df00163a3c774cdb7dfaf9edb9f95ec50bb3e4c8
Parents: 44bb6f1
Author: kunal642 <ku...@knoldus.in>
Authored: Fri Mar 10 12:36:46 2017 +0530
Committer: Venkata Ramana G <ra...@huawei.com>
Committed: Thu Mar 16 14:50:43 2017 +0530
----------------------------------------------------------------------
format/src/main/thrift/schema.thrift | 1 +
.../execution/command/carbonTableSchema.scala | 6 +
.../sql/execution/command/DDLStrategy.scala | 10 ++
.../execution/command/carbonTableSchema.scala | 136 +++++++++++++++----
.../apache/spark/sql/hive/CarbonMetastore.scala | 13 +-
.../AlterTableValidationTestCase.scala | 42 +++++-
6 files changed, 176 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/format/src/main/thrift/schema.thrift
----------------------------------------------------------------------
diff --git a/format/src/main/thrift/schema.thrift b/format/src/main/thrift/schema.thrift
index 775573c..a5f6e60 100644
--- a/format/src/main/thrift/schema.thrift
+++ b/format/src/main/thrift/schema.thrift
@@ -112,6 +112,7 @@ struct SchemaEvolutionEntry{
1: required i64 time_stamp;
2: optional list<ColumnSchema> added;
3: optional list<ColumnSchema> removed;
+ 4: optional string tableName;
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala b/integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index eb43a93..626dc37 100644
--- a/integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark-common/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -24,6 +24,7 @@ import scala.collection.JavaConverters._
import scala.collection.mutable.Map
import org.apache.spark.sql.SQLContext
+import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.carbondata.common.logging.LogServiceFactory
import org.apache.carbondata.core.constants.CarbonCommonConstants
@@ -134,6 +135,11 @@ case class AlterTableDataTypeChangeModel(dataTypeInfo: DataTypeInfo,
columnName: String,
newColumnName: String)
+case class AlterTableRenameModel(
+ oldTableIdentifier: TableIdentifier,
+ newTableIdentifier: TableIdentifier
+)
+
case class AlterTableAddColumnsModel(
databaseName: Option[String],
tableName: String,
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala
index 51808bd..cfeaadc 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala
@@ -35,6 +35,16 @@ class DDLStrategy(sparkSession: SparkSession) extends SparkStrategy {
if CarbonEnv.get.carbonMetastore.tableExists(identifier)(sparkSession) =>
ExecutedCommandExec(LoadTable(identifier.database, identifier.table.toLowerCase, path,
Seq(), Map(), isOverwrite)) :: Nil
+ case alter@AlterTableRenameCommand(oldTableIdentifier, newTableIdentifier, _) =>
+ val isCarbonTable = CarbonEnv.get.carbonMetastore
+ .tableExists(oldTableIdentifier)(
+ sparkSession)
+ if (isCarbonTable) {
+ val renameModel = AlterTableRenameModel(oldTableIdentifier, newTableIdentifier)
+ ExecutedCommandExec(AlterTableRenameTable(renameModel)) :: Nil
+ } else {
+ ExecutedCommandExec(alter) :: Nil
+ }
case DropTableCommand(identifier, ifNotExists, isView, _)
if CarbonEnv.get.carbonMetastore
.isTablePathExists(identifier)(sparkSession) =>
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index 28f4df8..4642559 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -18,14 +18,10 @@
package org.apache.spark.sql.execution.command
import java.io.File
-import java.util.concurrent.Callable
-import java.util.concurrent.Executors
-import java.util.concurrent.ExecutorService
-import java.util.concurrent.Future
+import java.util.concurrent.{Callable, ExecutorService, Executors, Future}
import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer
-import scala.collection.mutable.ListBuffer
import scala.language.implicitConversions
import org.apache.commons.lang3.StringUtils
@@ -45,15 +41,15 @@ import org.apache.carbondata.core.constants.CarbonCommonConstants
import org.apache.carbondata.core.datastore.impl.FileFactory
import org.apache.carbondata.core.dictionary.server.DictionaryServer
import org.apache.carbondata.core.locks.{CarbonLockFactory, LockUsage}
-import org.apache.carbondata.core.metadata.{CarbonMetadata, CarbonTableIdentifier}
import org.apache.carbondata.core.metadata.converter.ThriftWrapperSchemaConverterImpl
import org.apache.carbondata.core.metadata.encoder.Encoding
+import org.apache.carbondata.core.metadata.schema.table.column.{CarbonColumn, CarbonDimension}
import org.apache.carbondata.core.metadata.schema.table.{CarbonTable, TableInfo}
-import org.apache.carbondata.core.metadata.schema.table.column.{CarbonColumn, CarbonDimension, ColumnSchema}
+import org.apache.carbondata.core.metadata.{CarbonMetadata, CarbonTableIdentifier}
import org.apache.carbondata.core.mutate.{CarbonUpdateUtil, TupleIdEnum}
-import org.apache.carbondata.core.util.{CarbonProperties, CarbonUtil}
import org.apache.carbondata.core.util.path.CarbonStorePath
-import org.apache.carbondata.format.{ColumnSchema, SchemaEvolutionEntry}
+import org.apache.carbondata.core.util.{CarbonProperties, CarbonUtil}
+import org.apache.carbondata.format.SchemaEvolutionEntry
import org.apache.carbondata.processing.constants.TableOptionConstant
import org.apache.carbondata.processing.etl.DataLoadingException
import org.apache.carbondata.processing.model.{CarbonDataLoadSchema, CarbonLoadModel}
@@ -276,7 +272,6 @@ private[sql] case class AlterTableAddColumns(
.schema.SchemaEvolutionEntry()
schemaEvolutionEntry.setTimeStamp(System.currentTimeMillis)
schemaEvolutionEntry.setAdded(newCols.toList.asJava)
-
val thriftTable = schemaConverter
.fromWrapperToExternalTableInfo(wrapperTableInfo, dbName, tableName)
thriftTable.getFact_table.getSchema_evolution.getSchema_evolution_history.get(0)
@@ -286,7 +281,6 @@ private[sql] case class AlterTableAddColumns(
thriftTable,
schemaConverter.fromWrapperToExternalSchemaEvolutionEntry(schemaEvolutionEntry),
carbonTable.getStorePath)(sparkSession)
-
val tableIdentifier = TableIdentifier(tableName, Some(dbName))
val schema = CarbonEnv.get.carbonMetastore
.lookupRelation(tableIdentifier)(sparkSession).schema.json
@@ -313,6 +307,100 @@ private[sql] case class AlterTableAddColumns(
}
}
+private[sql] case class AlterTableRenameTable(alterTableRenameModel: AlterTableRenameModel)
+ extends RunnableCommand {
+
+ val LOGGER = LogServiceFactory.getLogService(this.getClass.getCanonicalName)
+
+ def run(sparkSession: SparkSession): Seq[Row] = {
+ val oldTableIdentifier = alterTableRenameModel.oldTableIdentifier
+ val newTableIdentifier = alterTableRenameModel.newTableIdentifier
+ val oldDatabaseName = oldTableIdentifier.database
+ .getOrElse(sparkSession.catalog.currentDatabase)
+ val newDatabaseName = newTableIdentifier.database
+ .getOrElse(sparkSession.catalog.currentDatabase)
+ if (!oldDatabaseName.equalsIgnoreCase(newDatabaseName)) {
+ throw new MalformedCarbonCommandException("Database name should be same for both tables")
+ }
+ val tableExists = sparkSession.catalog.tableExists(oldDatabaseName, newTableIdentifier.table)
+ if (tableExists) {
+ throw new MalformedCarbonCommandException(s"Table with name $newTableIdentifier " +
+ s"already exists")
+ }
+ val oldTableName = oldTableIdentifier.table.toLowerCase
+ val newTableName = newTableIdentifier.table.toLowerCase
+ LOGGER.audit(s"Rename table request has been received for $oldDatabaseName.$oldTableName")
+ LOGGER.info(s"Rename table request has been received for $oldDatabaseName.$oldTableName")
+ val relation: CarbonRelation =
+ CarbonEnv.get.carbonMetastore
+ .lookupRelation(oldTableIdentifier.database, oldTableName)(sparkSession)
+ .asInstanceOf[CarbonRelation]
+ if (relation == null) {
+ LOGGER.audit(s"Rename table request has failed. " +
+ s"Table $oldDatabaseName.$oldTableName does not exist")
+ }
+ val carbonTable = relation.tableMeta.carbonTable
+ val carbonLock = CarbonLockFactory
+ .getCarbonLockObj(carbonTable.getAbsoluteTableIdentifier.getCarbonTableIdentifier,
+ LockUsage.METADATA_LOCK)
+ if (carbonLock.lockWithRetries()) {
+ LOGGER.info("Successfully able to get the table metadata file lock")
+ } else {
+ sys.error("Table is locked for updation. Please try after some time")
+ }
+ try {
+ // get the latest carbon table and check for column existence
+ val carbonTablePath = CarbonStorePath.getCarbonTablePath(carbonTable.getStorePath,
+ carbonTable.getCarbonTableIdentifier)
+ val tableMetadataFile = carbonTablePath.getSchemaFilePath
+ val tableInfo: org.apache.carbondata.format.TableInfo = CarbonEnv.get.carbonMetastore
+ .readSchemaFile(tableMetadataFile)
+ val schemaEvolutionEntry = new SchemaEvolutionEntry(System.currentTimeMillis)
+ schemaEvolutionEntry.setTableName(newTableName)
+ val fileType = FileFactory.getFileType(tableMetadataFile)
+ if (FileFactory.isFileExist(tableMetadataFile, fileType)) {
+ val rename = FileFactory.getCarbonFile(carbonTablePath.getPath, fileType)
+ .renameForce(carbonTablePath.getParent.toString + CarbonCommonConstants.FILE_SEPARATOR +
+ newTableName)
+ if (!rename) {
+ sys.error(s"Rename failed for table $oldTableName")
+ }
+ }
+ val newTableIdentifier = new CarbonTableIdentifier(oldDatabaseName,
+ newTableName,
+ carbonTable.getCarbonTableIdentifier.getTableId)
+ val newTablePath = CarbonEnv.get.carbonMetastore.updateTableSchema(newTableIdentifier,
+ tableInfo,
+ schemaEvolutionEntry,
+ carbonTable.getStorePath)(sparkSession)
+ CarbonEnv.get.carbonMetastore.removeTableFromMetadata(oldDatabaseName, oldTableName)
+ sparkSession.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
+ .runSqlHive(
+ s"ALTER TABLE $oldDatabaseName.$oldTableName RENAME TO $newTableName")
+ sparkSession.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
+ .runSqlHive(
+ s"ALTER TABLE $oldDatabaseName.$newTableName SET SERDEPROPERTIES" +
+ s"('tableName'='$newTableName', " +
+ s"'dbName'='$oldDatabaseName', 'tablePath'='$newTablePath')")
+ LOGGER.audit(s"Table $oldTableName has been successfully renamed to $newTableName")
+ LOGGER.info(s"Table $oldTableName has been successfully renamed to $newTableName")
+ } catch {
+ case e: Exception => LOGGER.error("Rename table failed: " + e.getMessage)
+ throw e
+ } finally {
+ // release lock after command execution completion
+ if (carbonLock != null) {
+ if (carbonLock.unlock()) {
+ LOGGER.info("Lock released successfully")
+ } else {
+ LOGGER.error("Unable to release lock during rename table")
+ }
+ }
+ }
+ Seq.empty
+ }
+}
+
private[sql] case class AlterTableDropColumns(
alterTableDropColumnModel: AlterTableDropColumnModel) extends RunnableCommand {
@@ -468,8 +556,8 @@ case class CreateTable(cm: TableModel, createDSTable: Boolean = true) extends Ru
cm.msrCols.foreach(f => fields(f.schemaOrdinal) = f)
sparkSession.sql(
s"""CREATE TABLE $dbName.$tbName
- |(${fields.map(f => f.rawSchema).mkString(",")})
- |USING org.apache.spark.sql.CarbonSource""".stripMargin +
+ |(${fields.map(f => f.rawSchema).mkString(",")})
+ |USING org.apache.spark.sql.CarbonSource""".stripMargin +
s""" OPTIONS (tableName "$tbName", dbName "$dbName", tablePath "$tablePath") """)
} catch {
case e: Exception =>
@@ -593,7 +681,7 @@ case class LoadTableByInsert(relation: CarbonDatasourceHadoopRelation, child: Lo
Some(df)).run(sparkSession)
// updating relation metadata. This is in case of auto detect high cardinality
relation.carbonRelation.metaData =
- CarbonSparkUtil.createSparkMeta(relation.carbonRelation.tableMeta.carbonTable)
+ CarbonSparkUtil.createSparkMeta(relation.carbonRelation.tableMeta.carbonTable)
load
}
}
@@ -637,7 +725,7 @@ case class LoadTable(
}
val relation = CarbonEnv.get.carbonMetastore
- .lookupRelation(Option(dbName), tableName)(sparkSession).asInstanceOf[CarbonRelation]
+ .lookupRelation(Option(dbName), tableName)(sparkSession).asInstanceOf[CarbonRelation]
if (relation == null) {
sys.error(s"Table $dbName.$tableName does not exist")
}
@@ -650,10 +738,10 @@ case class LoadTable(
try {
// take lock only in case of normal data load.
if (!updateModel.isDefined) {
- if (carbonLock.lockWithRetries()) {
- LOGGER.info("Successfully able to get the table metadata file lock")
- } else {
- sys.error("Table is locked for updation. Please try after some time")
+ if (carbonLock.lockWithRetries()) {
+ LOGGER.info("Successfully able to get the table metadata file lock")
+ } else {
+ sys.error("Table is locked for updation. Please try after some time")
}
}
@@ -676,8 +764,8 @@ case class LoadTable(
carbonLoadModel.setCarbonDataLoadSchema(dataLoadSchema)
val partitionLocation = relation.tableMeta.storePath + "/partition/" +
- relation.tableMeta.carbonTableIdentifier.getDatabaseName + "/" +
- relation.tableMeta.carbonTableIdentifier.getTableName + "/"
+ relation.tableMeta.carbonTableIdentifier.getDatabaseName + "/" +
+ relation.tableMeta.carbonTableIdentifier.getTableName + "/"
val columnar = sparkSession.conf.get("carbon.is.columnar.storage", "true").toBoolean
@@ -747,14 +835,14 @@ case class LoadTable(
true
} else {
LOGGER.error("Can't use single_pass, because SINGLE_PASS and ALL_DICTIONARY_PATH" +
- "can not be used together, and USE_KETTLE must be set as false")
+ "can not be used together, and USE_KETTLE must be set as false")
false
}
case "false" =>
false
case illegal =>
LOGGER.error(s"Can't use single_pass, because illegal syntax found: [" + illegal + "] " +
- "Please set it as 'true' or 'false'")
+ "Please set it as 'true' or 'false'")
false
}
carbonLoadModel.setUseOnePass(useOnePass)
@@ -1146,4 +1234,4 @@ private[sql] case class DescribeCommandFormatted(
}
results
}
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
index 2e047e0..61f6ff6 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonMetastore.scala
@@ -141,12 +141,12 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
}
def lookupRelation(dbName: Option[String], tableName: String)
- (sparkSession: SparkSession): LogicalPlan = {
+ (sparkSession: SparkSession): LogicalPlan = {
lookupRelation(TableIdentifier(tableName, dbName))(sparkSession)
}
def lookupRelation(tableIdentifier: TableIdentifier, alias: Option[String] = None)
- (sparkSession: SparkSession): LogicalPlan = {
+ (sparkSession: SparkSession): LogicalPlan = {
checkSchemasModifiedTimeAndReloadTables()
val database = tableIdentifier.database.getOrElse(
sparkSession.catalog.currentDatabase
@@ -313,7 +313,7 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
thriftTableInfo: org.apache.carbondata.format.TableInfo,
schemaEvolutionEntry: SchemaEvolutionEntry,
carbonStorePath: String)
- (sparkSession: SparkSession): Unit = {
+ (sparkSession: SparkSession): String = {
val schemaConverter = new ThriftWrapperSchemaConverterImpl
val wrapperTableInfo = schemaConverter
.fromExternalToWrapperTableInfo(thriftTableInfo,
@@ -325,7 +325,6 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
thriftTableInfo,
carbonTableIdentifier.getDatabaseName,
carbonTableIdentifier.getTableName)(sparkSession)
- // add a logger after completion saying update schema is success for given db and table name
}
/**
@@ -389,7 +388,7 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
removeTableFromMetadata(dbName, tableName)
CarbonMetadata.getInstance().loadTableMetadata(tableInfo)
val tableMeta = new TableMeta(carbonTableIdentifier, storePath,
- CarbonMetadata.getInstance().getCarbonTable(dbName + '_' + tableName))
+ CarbonMetadata.getInstance().getCarbonTable(dbName + '_' + tableName))
metadata.tablesMeta += tableMeta
carbonTablePath.getPath
}
@@ -400,7 +399,7 @@ class CarbonMetastore(conf: RuntimeConfig, val storePath: String) {
* @param dbName
* @param tableName
*/
- private def removeTableFromMetadata(dbName: String, tableName: String) = {
+ def removeTableFromMetadata(dbName: String, tableName: String) = {
val metadataToBeRemoved: Option[TableMeta] = getTableFromMetadata(dbName, tableName)
metadataToBeRemoved match {
case Some(tableMeta) =>
@@ -908,7 +907,7 @@ case class CarbonRelation(
var dType = dataType
if (dimval.getDataType == DECIMAL) {
dType +=
- "(" + dimval.getColumnSchema.getPrecision + "," + dimval.getColumnSchema.getScale + ")"
+ "(" + dimval.getColumnSchema.getPrecision + "," + dimval.getColumnSchema.getScale + ")"
}
dType
}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/df00163a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
index 4fdb714..82de5bc 100644
--- a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
+++ b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
@@ -16,7 +16,9 @@ class AlterTableValidationTestCase extends QueryTest with BeforeAndAfterAll {
// clean data folder
CarbonProperties.getInstance()
sql("CREATE TABLE restructure (empno int, empname String, designation String, doj Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int,utilization int,salary int) STORED BY 'org.apache.carbondata.format'")
- sql(s"""LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE restructure OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')""");
+ sql(s"""LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE restructure OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')""")
+ sql("CREATE TABLE restructure_test (empno int, empname String, designation String, doj Timestamp, workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int,utilization int,salary int) STORED BY 'org.apache.carbondata.format'")
+ sql(s"""LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE restructure_test OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')""")
}
test("test add dictionary column") {
@@ -105,7 +107,45 @@ class AlterTableValidationTestCase extends QueryTest with BeforeAndAfterAll {
assert(true)
}
}
+
+ test("test to rename table") {
+ sql("alter table restructure_test rename to restructure_new")
+ val result = sql("select * from restructure_new")
+ assert(result.count().equals(10L))
+ }
+
+ test("test to rename table with invalid table name") {
+ try {
+ sql("alter table restructure_invalid rename to restructure_new")
+ assert(false)
+ } catch{
+ case e:Exception =>
+ println(e.getMessage)
+ assert(true)
+ }
+ }
+
+ test("test to rename table with table already exists") {
+ try {
+ sql("alter table restructure rename to restructure")
+ assert(false)
+ } catch {
+ case e:Exception =>
+ println(e.getMessage)
+ assert(true)
+ }
+ }
+
+ test("test to load data after rename") {
+ sql(s"""LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE restructure_new OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')""")
+ val result = sql("select * from restructure_new")
+ assert(result.count().equals(20L))
+ }
+
override def afterAll {
sql("DROP TABLE IF EXISTS restructure")
+ sql("DROP TABLE IF EXISTS restructure_new")
+ sql("DROP TABLE IF EXISTS restructure_test")
}
+
}