Skip to content

Commit

Permalink
[CARBONDATA-3065]Correct the error message for inverted index columns…
Browse files Browse the repository at this point in the history
… and update the docment

Modified the error message when column present in Inverted index is not present in Schema
Updated the table property in user document

This closes #2924
  • Loading branch information
brijoobopanna authored and kunal642 committed Nov 16, 2018
1 parent 851dd2c commit 0c02e98
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/ddl-of-carbondata.md
Expand Up @@ -86,6 +86,7 @@ CarbonData DDL statements are documented here,which includes:
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [DICTIONARY_INCLUDE](#dictionary-encoding-configuration) | Columns for which dictionary needs to be generated |
| [NO_INVERTED_INDEX](#inverted-index-configuration) | Columns to exclude from inverted index generation |
| [INVERTED_INDEX](#inverted-index-configuration) | Columns to include for inverted index generation |
| [SORT_COLUMNS](#sort-columns-configuration) | Columns to include in sort and its order of sort |
| [SORT_SCOPE](#sort-scope-configuration) | Sort scope of the load.Options include no sort, local sort ,batch sort and global sort |
| [TABLE_BLOCKSIZE](#table-block-size-configuration) | Size of blocks to write onto hdfs |
Expand Down
Expand Up @@ -1345,6 +1345,15 @@ class SparkCarbonDataSourceTest extends FunSuite with BeforeAndAfterAll {
spark.sql("drop table if exists fileformat_drop_hive")
}

test("validate the columns not present in schema") {
spark.sql("drop table if exists validate")
spark.sql("create table validate (name string, age int, address string) using carbon options('inverted_index'='abc')")
val ex = intercept[Exception] {
spark.sql("insert into validate select 'abc',4,'def'")
}
assert(ex.getMessage.contains("column: abc specified in inverted index columns does not exist in schema"))
}

override protected def beforeAll(): Unit = {
drop
createParquetTable
Expand All @@ -1360,5 +1369,6 @@ class SparkCarbonDataSourceTest extends FunSuite with BeforeAndAfterAll {
spark.sql("drop table if exists testparquet")
spark.sql("drop table if exists par_table")
spark.sql("drop table if exists sdkout")
spark.sql("drop table if exists validate")
}
}
Expand Up @@ -618,8 +618,8 @@ private void buildTableSchema(Field[] fields, TableSchemaBuilder tableSchemaBuil
}
}
if (!exists) {
throw new RuntimeException(
"column: " + invertedIdxColumn + " specified in sort columns does not exist in schema");
throw new RuntimeException("column: " + invertedIdxColumn
+ " specified in inverted index columns does not exist in schema");
}
}
int i = 0;
Expand Down

0 comments on commit 0c02e98

Please sign in to comment.