Skip to content

Commit

Permalink
Revise
Browse files Browse the repository at this point in the history
  • Loading branch information
W1thOut committed Aug 16, 2021
1 parent 7fa6471 commit 5eb06ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class CarbonSpark2SqlParser extends CarbonDDLSqlParser {
cacheManagement | insertStageData | indexCommands | mvCommands | describeCommands

protected lazy val segmentManagement: Parser[LogicalPlan] =
deleteSegmentByID | deleteSegmentByLoadDate | deleteSegmentByRemainNumber |
deleteStage | cleanFiles | addSegment | showSegments
deleteSegmentByID | deleteSegmentByLoadDate | deleteStage | cleanFiles | addSegment |
showSegments | deleteSegmentByRemainNumber

protected lazy val restructure: Parser[LogicalPlan] = alterTableDropColumn

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DeleteSegmentByRemainNumberTestCase extends QueryTest with BeforeAndAfterA
val ex = intercept[Exception] {
sql("delete from table deleteSegmentTable expect segment.remain_number = -1")
}
assert(ex.getMessage.contains("not found in database"))
assert(ex.getMessage.contains("not found"))
}

test("delete segment after update") {
Expand All @@ -87,16 +87,17 @@ class DeleteSegmentByRemainNumberTestCase extends QueryTest with BeforeAndAfterA
sql("drop table if exists deleteSegmentTable")
sql(
"CREATE table deleteSegmentTable (ID int, date String, country String, name " +
"String, phonetype String, serialname String, salary String) STORED AS carbondata"
"String, phonetype String, serialname String, salary String) STORED AS carbondata " +
"PARTITIONED by(age int)"
)
sql(
s"""LOAD DATA local inpath '$resourcesPath/dataretention1.csv'
| INTO TABLE deleteSegmentTable OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
| INTO TABLE deleteSegmentTable PARTITION (age='20') OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
sql(
s"""LOAD DATA local inpath '$resourcesPath/dataretention2.csv'
| INTO TABLE deleteSegmentTable OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
| INTO TABLE deleteSegmentTable PARTITION (age='30') OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
sql(
s"""LOAD DATA local inpath '$resourcesPath/dataretention3.csv'
| INTO TABLE deleteSegmentTable OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
| INTO TABLE deleteSegmentTable PARTITION (age='40') OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '"')""".stripMargin)
}
}
}

0 comments on commit 5eb06ba

Please sign in to comment.