Skip to content

Commit

Permalink
Fix SORT_SCOPE with no SORT_COLUMNS
Browse files Browse the repository at this point in the history
1. With SORT_COLUMNS=null, loading data was resulting in SORT_SCOPE=LOCAL_SORT.

2. With SORT_COLUMNS!=null and SORT_SCOPE not provided, loading data was not checking CARBON.OPTIONS.SORT.SCOPE.
  • Loading branch information
NamanRastogi committed Jan 25, 2019
1 parent 028eb25 commit 74ff915
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,21 @@ case class CarbonLoadDataCommand(
* 4. Session property CARBON_OPTIONS_SORT_SCOPE
* 5. Default Sort Scope LOAD_SORT_SCOPE
*/
if (tableProperties.get(CarbonCommonConstants.SORT_COLUMNS) != null &&
tableProperties.get(CarbonCommonConstants.SORT_SCOPE) == null) {
// If there are Sort Columns given for the table and Sort Scope is not specified,
// we will take it as whichever sort scope given or LOCAL_SORT as default
optionsFinal
.put(CarbonCommonConstants.SORT_SCOPE,
carbonProperty
.getProperty(
CarbonLoadOptionConstants.CARBON_TABLE_LOAD_SORT_SCOPE + table.getDatabaseName + "." +
table.getTableName, carbonProperty.getProperty(CarbonCommonConstants.LOAD_SORT_SCOPE,
SortScopeOptions.getSortScope("LOCAL_SORT").toString)))
if (tableProperties.get(CarbonCommonConstants.SORT_COLUMNS) == null ||
tableProperties.get(CarbonCommonConstants.SORT_COLUMNS).equals("")) {
// If tableProperties.SORT_COLUMNS is null
optionsFinal.put(CarbonCommonConstants.SORT_SCOPE, "NO_SORT")
}
else if (tableProperties.get(CarbonCommonConstants.SORT_SCOPE) == null ||
tableProperties.get(CarbonCommonConstants.SORT_SCOPE).equals("")) {
// If tableProperties.SORT_COLUMNS is not null
// and tableProperties.SORT_SCOPE is null
optionsFinal.put(CarbonCommonConstants.SORT_SCOPE,
carbonProperty.getProperty(CarbonLoadOptionConstants.CARBON_TABLE_LOAD_SORT_SCOPE +
table.getDatabaseName + "." + table.getTableName,
carbonProperty.getProperty(CarbonLoadOptionConstants.CARBON_OPTIONS_SORT_SCOPE,
carbonProperty.getProperty(CarbonCommonConstants.LOAD_SORT_SCOPE,
"LOCAL_SORT"))))
} else {
optionsFinal.put(CarbonCommonConstants.SORT_SCOPE,
options.getOrElse(CarbonCommonConstants.SORT_SCOPE,
Expand Down

0 comments on commit 74ff915

Please sign in to comment.