GitHub user jatin9896 opened a pull request:
https://github.com/apache/carbondata/pull/1914 [CARBONDATA-2122] Corrected bad record path validation Data Load having bad record redirect with empty location should throw the exception of Invalid Path. Be sure to do all of the following checklist to help us incorporate your contribution quickly and easily: - [ ] Any interfaces changed?No - [ ] Any backward compatibility impacted?No - [ ] Document update required?No - [ ] Testing done Please provide details on - Whether new unit test cases have been added or why no new tests are required?Yes - How it is tested? Please attach test report. - Is it a performance related change? Please attach the performance test report. - Any additional information to help reviewers in testing this change. - [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jatin9896/incubator-carbondata CARBONDATA-2122 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/1914.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1914 ---- commit 0bc09a48210b534fbb8be1c9bb815fc00906215c Author: Jatin <jatin.demla@...> Date: 2018-02-02T14:25:16Z corrected bad record path validation ---- --- |
Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1914#discussion_r165674058 --- Diff: core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java --- @@ -1891,7 +1892,8 @@ public static boolean validateValidIntType(String value) { * @return */ public static boolean isValidBadStorePath(String badRecordsLocation) { - return !(null == badRecordsLocation || badRecordsLocation.length() == 0); + if (StringUtils.isEmpty(badRecordsLocation)) return false; + else return isFileExists(checkAndAppendHDFSUrl(badRecordsLocation)); --- End diff -- Follow code formatting if (StringUtils.isEmpty(badRecordsLocation)) { return false; } --- |
In reply to this post by qiuchenjian-2
Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1914#discussion_r165676157 --- Diff: integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/DataLoadingUtil.scala --- @@ -229,11 +229,11 @@ object DataLoadingUtil { if (bad_records_logger_enable.toBoolean || LoggerAction.REDIRECT.name().equalsIgnoreCase(bad_records_action)) { - bad_record_path = CarbonUtil.checkAndAppendHDFSUrl(bad_record_path) if (!CarbonUtil.isValidBadStorePath(bad_record_path)) { CarbonException.analysisException("Invalid bad records location.") } } + bad_record_path = CarbonUtil.checkAndAppendHDFSUrl(bad_record_path) --- End diff -- Move the condition up in if block after validation --- |
In reply to this post by qiuchenjian-2
Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1914#discussion_r165675863 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordActionTest.scala --- @@ -92,6 +92,44 @@ class BadRecordActionTest extends QueryTest with BeforeAndAfterAll { Seq(Row(2))) } + test("test bad record REDIRECT but not having location should throw exception"){ + sql("drop table if exists sales") + 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'""") + val exMessage = intercept[Exception]{ + sql("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales OPTIONS" + + "('bad_records_action'='REDIRECT', 'DELIMITER'=" + + " ',', 'QUOTECHAR'= '\"', 'BAD_RECORD_PATH'='')") + } + assert(exMessage.getMessage.contains("Invalid bad records location.")) + } + + test("test bad record is REDIRECT with location in carbon properties should pass"){ + sql("drop table if exists sales") + CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,"/tmp") + sql("drop table if exists sales") + 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("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales OPTIONS" + + "('bad_records_action'='REDIRECT', 'DELIMITER'=" + + " ',', 'QUOTECHAR'= '\"')") + } + + test("test bad record is redirect with location in option while data loading should pass"){ + sql("drop table if exists sales") + CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,"") --- End diff -- Instead of quotes use the default value from CarboNCommonConsstants --- |
In reply to this post by qiuchenjian-2
Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1914#discussion_r165675592 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordActionTest.scala --- @@ -92,6 +92,44 @@ class BadRecordActionTest extends QueryTest with BeforeAndAfterAll { Seq(Row(2))) } + test("test bad record REDIRECT but not having location should throw exception"){ + sql("drop table if exists sales") + 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'""") + val exMessage = intercept[Exception]{ + sql("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales OPTIONS" + + "('bad_records_action'='REDIRECT', 'DELIMITER'=" + + " ',', 'QUOTECHAR'= '\"', 'BAD_RECORD_PATH'='')") + } + assert(exMessage.getMessage.contains("Invalid bad records location.")) + } + + test("test bad record is REDIRECT with location in carbon properties should pass"){ + sql("drop table if exists sales") + CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BADRECORDS_LOC,"/tmp") + sql("drop table if exists sales") + 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("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE sales OPTIONS" + + "('bad_records_action'='REDIRECT', 'DELIMITER'=" + + " ',', 'QUOTECHAR'= '\"')") --- End diff -- 1. Put the test case in try and finally block 2. Add the bad store path in try and in finally rest the path to default --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2211/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3451/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2216/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3456/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3458/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2218/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3461/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2221/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1914 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3315/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1914 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3317/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1914 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3318/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/2224/ --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1914 Build Failed with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/3464/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1914 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3319/ --- |
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:
https://github.com/apache/carbondata/pull/1914 SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/3323/ --- |
Free forum by Nabble | Edit this page |