/** * @param sortOrder Sort order. * @param qry Query. */ private void processSortOrder(SortOrder sortOrder, GridSqlQuery qry) { if (sortOrder == null) return; int[] indexes = sortOrder.getQueryColumnIndexes(); int[] sortTypes = sortOrder.getSortTypes(); for (int i = 0; i < indexes.length; i++) { int colIdx = indexes[i]; int type = sortTypes[i]; qry.addSort(new GridSqlSortColumn(colIdx, (type & SortOrder.DESCENDING) == 0, (type & SortOrder.NULLS_FIRST) != 0, (type & SortOrder.NULLS_LAST) != 0)); } }
boolean sortOrderMatches = true; int coveringCount = 0; int[] sortTypes = sortOrder.getSortTypes(); TableFilter tableFilter = filters == null ? null : filters[filter]; for (int i = 0, len = sortTypes.length; i < len; i++) {
private void createIndex() { IndexColumn[] indexCols = null; // If we need to do distinct, the distinct columns may not match the // sort columns. So we need to disregard the sort. Not ideal. if (sort != null && !distinct) { int[] colIndex = sort.getQueryColumnIndexes(); indexCols = new IndexColumn[colIndex.length]; for (int i = 0; i < colIndex.length; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(colIndex[i]); indexColumn.sortType = sort.getSortTypes()[i]; indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } else { indexCols = new IndexColumn[columnCount]; for (int i = 0; i < columnCount; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(i); indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } String indexName = table.getSchema().getUniqueIndexName(session, table, Constants.PREFIX_INDEX); int indexId = session.getDatabase().allocateObjectId(); IndexType indexType = IndexType.createNonUnique(true); index = table.addIndex(session, indexName, indexId, indexCols, indexType, true, null); }
/** * @param sortOrder Sort order. * @param qry Query. */ private void processSortOrder(SortOrder sortOrder, GridSqlQuery qry) { if (sortOrder == null) return; int[] indexes = sortOrder.getQueryColumnIndexes(); int[] sortTypes = sortOrder.getSortTypes(); for (int i = 0; i < indexes.length; i++) { int colIdx = indexes[i]; int type = sortTypes[i]; qry.addSort(new GridSqlSortColumn(colIdx, (type & SortOrder.DESCENDING) == 0, (type & SortOrder.NULLS_FIRST) != 0, (type & SortOrder.NULLS_LAST) != 0)); } }
int[] sortTypes = sort.getSortTypes(); if (sortCols.length == 0) {
boolean sortOrderMatches = true; int coveringCount = 0; int[] sortTypes = sortOrder.getSortTypes(); TableFilter tableFilter = filters == null ? null : filters[filter]; for (int i = 0, len = sortTypes.length; i < len; i++) {
int[] sortTypes = sort.getSortTypes(); if (sortCols.length == 0) {
boolean sortOrderMatches = true; int coveringCount = 0; int[] sortTypes = sortOrder.getSortTypes(); TableFilter tableFilter = filters == null ? null : filters[filter]; for (int i = 0, len = sortTypes.length; i < len; i++) {
private void createIndex() { IndexColumn[] indexCols = null; if (sort != null) { int[] colIndex = sort.getQueryColumnIndexes(); indexCols = new IndexColumn[colIndex.length]; for (int i = 0; i < colIndex.length; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(colIndex[i]); indexColumn.sortType = sort.getSortTypes()[i]; indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } else { indexCols = new IndexColumn[columnCount]; for (int i = 0; i < columnCount; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(i); indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } String indexName = table.getSchema().getUniqueIndexName(session, table, Constants.PREFIX_INDEX); int indexId = session.getDatabase().allocateObjectId(); IndexType indexType = IndexType.createNonUnique(true); index = table.addIndex(session, indexName, indexId, indexCols, indexType, true, null); }
private void createIndex() { IndexColumn[] indexCols = null; // If we need to do distinct, the distinct columns may not match the sort columns // so we need to disregard the sort. Not ideal. if (sort != null && !distinct) { int[] colIndex = sort.getQueryColumnIndexes(); indexCols = new IndexColumn[colIndex.length]; for (int i = 0; i < colIndex.length; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(colIndex[i]); indexColumn.sortType = sort.getSortTypes()[i]; indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } else { indexCols = new IndexColumn[columnCount]; for (int i = 0; i < columnCount; i++) { IndexColumn indexColumn = new IndexColumn(); indexColumn.column = table.getColumn(i); indexColumn.columnName = COLUMN_NAME + i; indexCols[i] = indexColumn; } } String indexName = table.getSchema().getUniqueIndexName(session, table, Constants.PREFIX_INDEX); int indexId = session.getDatabase().allocateObjectId(); IndexType indexType = IndexType.createNonUnique(true); index = table.addIndex(session, indexName, indexId, indexCols, indexType, true, null); }
int[] sortTypes = sort.getSortTypes(); if (sortCols.length == 0) {