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

    https://github.com/apache/carbondata/pull/1404#discussion_r143897439
  
    --- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/integration/spark/testsuite/dataload/LoadDataWithBadRecords.scala
 ---
    @@ -0,0 +1,178 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.carbondata.integration.spark.testsuite.dataload
    +
    +import java.io.File
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.spark.sql.Row
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach}
    +
    +class LoadDataWithBadRecordsTest extends QueryTest with BeforeAndAfterEach 
with BeforeAndAfterAll {
    +  override def beforeEach(): Unit = {
    +    sql("drop table if exists sales")
    +    sql("drop table if exists int_table")
    +    sql("drop table if exists boolean_table")
    +    sql(
    +      """CREATE TABLE IF NOT EXISTS sales(ID BigInt, date Timestamp, 
country String,
    +                  actual_price Double, Quantity int, sold_price 
Decimal(19,2)) STORED BY 'carbondata'""")
    +    sql("CREATE TABLE if not exists int_table(intField INT) STORED BY 
'carbondata'")
    +    sql("CREATE TABLE if not exists boolean_table(booleanField INT) STORED 
BY 'carbondata'")
    +  }
    +
    +  override def beforeAll(): Unit = {
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, 
"yyyy/MM/dd")
    +      .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, "yyyy/MM/dd")
    +      .addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,
    +        new File("./target/test/badRecords")
    +          .getCanonicalPath)
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("drop table if exists sales")
    +    sql("drop table if exists int_table")
    +    sql("drop table if exists boolean_table")
    +    CarbonProperties.getInstance()
    +      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, 
CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
    +      .addProperty(CarbonCommonConstants.CARBON_DATE_FORMAT, 
CarbonCommonConstants.CARBON_DATE_DEFAULT_FORMAT)
    +      .addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC, 
CarbonCommonConstants.CARBON_BADRECORDS_LOC_DEFAULT_VAL)
    +  }
    +
    +  val rootPath = new File(this.getClass.getResource("/").getPath
    +    + "../../../../").getCanonicalPath
    +
    +  val path = 
s"$rootPath/integration/spark-common-test/src/test/resources/badrecords/datasample.csv"
    +
    +  test("The bad_records_action: FORCE") {
    +    sql("LOAD DATA local inpath '" + path + "' INTO TABLE sales OPTIONS" +
    --- End diff --
    
    Ok, I have changed it.


---

Reply via email to