Github user xuchuanyin commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2254#discussion_r185234523
--- Diff:
core/src/main/java/org/apache/carbondata/core/metadata/schema/table/CarbonTable.java
---
@@ -986,4 +990,26 @@ public boolean canAllow(CarbonTable carbonTable,
TableOperation operation) {
return true;
}
+ /**
+ * Get all index columns specified by dataMapSchema
+ */
+ public List<CarbonColumn> getIndexedColumns(DataMapSchema dataMapSchema)
+ throws MalformedDataMapCommandException {
+ String[] columns = DataMapFactory.getIndexColumns(dataMapSchema);
+ List<CarbonColumn> indexColumn = new ArrayList<>(columns.length);
+ for (String column : columns) {
+ CarbonColumn carbonColumn = getColumnByName(getTableName(),
column.trim().toLowerCase());
+ if (carbonColumn == null) {
+ throw new MalformedDataMapCommandException(String.format(
+ "column '%s' does not exist in table. Please check create
DataMap statement.",
+ column));
+ }
+ if (carbonColumn.getColName().isEmpty()) {
+ throw new MalformedDataMapCommandException(
+ DataMapFactory.INDEX_COLUMNS + " contains invalid column
name");
--- End diff --
I think the `INDEX_COLUMNS` can be moved to `CarbonCommonConstants`. Many
other properties (create table/create datamap) are defined there.
---