Skip to content

Commit

Permalink
Merge ea52aca into 2ecf30c
Browse files Browse the repository at this point in the history
  • Loading branch information
NamanRastogi committed Jan 31, 2019
2 parents 2ecf30c + ea52aca commit bc68b2c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 6 deletions.
16 changes: 16 additions & 0 deletions core/src/main/java/org/apache/carbondata/core/util/CarbonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3338,4 +3338,20 @@ public static int[] getInvertedReverseIndex(int[] invertedIndex) {
public static String generateUUID() {
return UUID.randomUUID().toString();
}

/**
* Below method will be used to get the datamap schema name from datamap table name
* it will split name based on _ and get the last name
* This is only for pre aggregate and timeseries tables
*
* @param tableName
* @return datamapschema name
*/
public static String getDatamapNameFromTableName(String tableName) {
int i = tableName.lastIndexOf('_');
if (i != -1) {
return tableName.substring(i + 1, tableName.length());
}
return null;
}
}
18 changes: 18 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- [Failed to insert data on the cluster](#failed-to-insert-data-on-the-cluster)
- [Failed to execute Concurrent Operations(Load,Insert,Update) on table by multiple workers](#failed-to-execute-concurrent-operations-on-table-by-multiple-workers)
- [Failed to create a table with a single numeric column](#failed-to-create-a-table-with-a-single-numeric-column)
- [Failed to create datamap and drop-datamap is also not working](#failed-to-create-datamap-and-drop-datamap-is-also-not-working)

##

Expand Down Expand Up @@ -474,4 +475,21 @@ Note : Refrain from using "mvn clean package" without specifying the profile.

A single column that can be considered as dimension is mandatory for table creation.

## Failed to create datamap and drop-datamap is also not working

**Symptom**

Execution fails with the following exception :

```
HDFS Quota Exceeded
```

**Possible Cause**

HDFS Quota is set, and it is not letting carbondata write or modify any files.

**Procedure**

Drop that particular datamap using Drop Table command using table name as
parentTableName_datamapName so as to clear the stale folders.
Original file line number Diff line number Diff line change
Expand Up @@ -10697,8 +10697,8 @@ class QueriesBVATestCase extends QueryTest with BeforeAndAfterAll {
//PushUP_FILTER_test_boundary_TC194
test("PushUP_FILTER_test_boundary_TC194", Include) {

checkAnswer(s"""select min(c2_Bigint),max(c2_Bigint),sum(c2_Bigint),avg(c2_Bigint) , count(c2_Bigint), variance(c2_Bigint) from Test_Boundary where sin(c1_int)=0.18796200317975467 or sin(c1_int)=-0.18796200317975467""",
s"""select min(c2_Bigint),max(c2_Bigint),sum(c2_Bigint),avg(c2_Bigint) , count(c2_Bigint), variance(c2_Bigint) from Test_Boundary_hive where sin(c1_int)=0.18796200317975467 or sin(c1_int)=-0.18796200317975467""", "QueriesBVATestCase_PushUP_FILTER_test_boundary_TC194")
checkAnswer(s"""select min(c2_Bigint),max(c2_Bigint),sum(c2_Bigint),avg(c2_Bigint) , count(c2_Bigint), variance(c2_Bigint) from (select c2_Bigint from Test_Boundary where sin(c1_int)=0.18796200317975467 or sin(c1_int)=-0.18796200317975467 order by c2_Bigint""",
s"""select min(c2_Bigint),max(c2_Bigint),sum(c2_Bigint),avg(c2_Bigint) , count(c2_Bigint), variance(c2_Bigint) from (select c2_Bigint from Test_Boundary_hive where sin(c1_int)=0.18796200317975467 or sin(c1_int)=-0.18796200317975467 order by c2_Bigint""", "QueriesBVATestCase_PushUP_FILTER_test_boundary_TC194")

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ case class CarbonLoadDataCommand(
* 4. Session property CARBON_OPTIONS_SORT_SCOPE
* 5. Default Sort Scope LOAD_SORT_SCOPE
*/
if (StringUtils.isBlank(tableProperties.get(CarbonCommonConstants.SORT_COLUMNS))) {
if (table.getNumberOfSortColumns == 0) {
// If tableProperties.SORT_COLUMNS is null
optionsFinal.put(CarbonCommonConstants.SORT_SCOPE,
SortScopeOptions.SortScope.NO_SORT.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ private[sql] case class CarbonAlterTableRenameCommand(
schemaEvolutionEntry.setTime_stamp(timeStamp)
val newCarbonTableIdentifier = new CarbonTableIdentifier(oldDatabaseName,
newTableName, carbonTable.getCarbonTableIdentifier.getTableId)
val oldIdentifier = TableIdentifier(oldTableName, Some(oldDatabaseName))
val newIdentifier = TableIdentifier(newTableName, Some(oldDatabaseName))
metastore.removeTableFromMetadata(oldDatabaseName, oldTableName)
var partitions: Seq[CatalogTablePartition] = Seq.empty
if (carbonTable.isHivePartitionTable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,37 @@ case class CarbonDropTableCommand(
}
val relationIdentifiers = carbonTable.getTableInfo.getParentRelationIdentifiers
if (relationIdentifiers != null && !relationIdentifiers.isEmpty) {
if (!dropChildTable) {
var ignoreParentTableCheck = false
if (carbonTable.getTableInfo.getParentRelationIdentifiers.size() == 1) {
// below handling in case when pre aggregation creation failed in below scenario
// while creating a pre aggregate data map it created pre aggregate table and registered
// in hive, but failed to register in main table because of some exception.
// in this case if it will not allow user to drop datamap and data map table
// for this if user run drop table command for pre aggregate it should allow user to drop
// the same
val parentDbName = carbonTable.getTableInfo.getParentRelationIdentifiers.get(0)
.getDatabaseName
val parentTableName = carbonTable.getTableInfo.getParentRelationIdentifiers.get(0)
.getTableName
val parentCarbonTable = try {
Some(CarbonEnv
.getCarbonTable(Some(parentDbName), parentTableName)(sparkSession))
} catch {
case _: Exception =>
None
}
if (parentCarbonTable.isDefined) {
val dataMapSchemaName = CarbonUtil
.getDatamapNameFromTableName(carbonTable.getTableName)
if (null != dataMapSchemaName) {
val dataMapSchema = parentCarbonTable.get.getDataMapSchema(dataMapSchemaName)
if (null == dataMapSchema) {
ignoreParentTableCheck = true
}
}
}
}
if (!ignoreParentTableCheck && !dropChildTable) {
if (!ifExistsSet) {
throwMetadataException(dbName, tableName,
"Child table which is associated with datamap cannot be dropped, " +
Expand Down

0 comments on commit bc68b2c

Please sign in to comment.