Check for duplicate column names

@param index
index
@param previousIndex
previous index
@param column
column
181407
protected void duplicateCheck(int index, Integer previousIndex,
			String column) {
		if (previousIndex != null) {
			throw new GeoPackageException("More than one " + column
					+ " column was found for table '" + tableName + "'. Index "
					+ previousIndex + " and " + index);

		}
	}
538583
def index_column(self, index_name, table, column):
        """"""
        cursor = self.get_cursor()
        try:
            cursor.execute(
                'CREATE INDEX {0} on {1}({2})'.format(index_name, table, column))
        except sqlite3.OperationalError as error:
            print(error)
            print('Skipping index creation and assuming it exists already')
        else:
            self.conn.commit()
661318
def _check_fill_title_column(self, column_index):
        '''
        
        '''
        # Determine if the whole column is titles
        table_column = TableTranspose(self.table)[column_index]
        prior_column = TableTranspose(self.table)[column_index-1] if column_index > 0 else table_column
        for row_index in range(self.start[0], self.end[0]):
            if is_num_cell(table_column[row_index]) or is_num_cell(prior_column[row_index]):
                return
        # Since we're a title row, stringify the column
        self._stringify_column(column_index)
896014
void onColumnSelect(final int index, final boolean selected) {
        final DataColumnDef columnDef = acceptableColumns.get(index);
        if (selected) {
            listEditor.getList().add(columnDef.clone());
        } else {
            listEditor.getList().remove(columnDef);
        }
        columnsChangedEvent.fire(new ColumnsChangedEvent(this, listEditor.getList()));
    }
604841
public void addColumn(String column) {

        m_columns.add(new CmsSimpleQueryFragment(column, Collections.<Object> emptyList()));
    }
1109742
function GetColumnNameByIndex($index, $remove_prefix = true)
	{
		$count = 0;
		foreach ($this->Columns as $column)
		{
			if ($count == $index) return ($remove_prefix) ? $column->NameWithoutPrefix : $column->Name;
		}
		
		throw new Exception('Index out of bounds');
	}
741989
public boolean isExists(String index) {
        IndicesExistsRequestBuilder indicesExistsRequestBuilder =
                admin().indices().prepareExists(index);
        return JMElasticsearchUtil
                .logRequestQueryAndReturn("isExists",
                        indicesExistsRequestBuilder,
                        indicesExistsRequestBuilder.execute())
                .isExists();
    }
1078571
private static boolean indexesAreDups(Index idx1, Index idx2) {
        // same attributes?
        if (idx1.getType() != idx2.getType()) {
            return false;
        }
        if (idx1.getCountable() != idx2.getCountable()) {
            return false;
        }
        if (idx1.getUnique() != idx2.getUnique()) {
            return false;
        }
        if (idx1.getAssumeunique() != idx2.getAssumeunique()) {
            return false;
        }

        // same column count?
        if (idx1.getColumns().size() != idx2.getColumns().size()) {
            return false;
        }

        //TODO: For index types like HASH that support only random access vs. scanned ranges, indexes on different
        // permutations of the same list of columns/expressions could be considered dupes. This code skips that edge
        // case optimization in favor of using a simpler more exact permutation-sensitive algorithm for all indexes.

        if ( ! (idx1.getExpressionsjson().equals(idx2.getExpressionsjson()))) {
            return false;
        }

        // Simple column indexes have identical empty expression strings so need to be distinguished other ways.
        // More complex expression indexes that have the same expression strings always have the same set of (base)
        // columns referenced in the same order, but we fall through and check them, anyway.

        // sort in index order the columns of idx1, each identified by its index in the base table
        int[] idx1baseTableOrder = new int[idx1.getColumns().size()];
        for (ColumnRef cref : idx1.getColumns()) {
            int index = cref.getIndex();
            int baseTableIndex = cref.getColumn().getIndex();
            idx1baseTableOrder[index] = baseTableIndex;
        }

        // sort in index order the columns of idx2, each identified by its index in the base table
        int[] idx2baseTableOrder = new int[idx2.getColumns().size()];
        for (ColumnRef cref : idx2.getColumns()) {
            int index = cref.getIndex();
            int baseTableIndex = cref.getColumn().getIndex();
            idx2baseTableOrder[index] = baseTableIndex;
        }

        // Duplicate indexes have identical columns in identical order.
        if ( ! Arrays.equals(idx1baseTableOrder, idx2baseTableOrder) ) {
            return false;
        }

        // Check the predicates
        if (idx1.getPredicatejson().length() > 0) {
            return idx1.getPredicatejson().equals(idx2.getPredicatejson());
        }
        if (idx2.getPredicatejson().length() > 0) {
            return idx2.getPredicatejson().equals(idx1.getPredicatejson());
        }
        return true;
    }
1051503
@Override
    public void deleteIndex(final String indexName) throws QueryException {
        Misc.checkNotNullOrEmpty(indexName, "indexName");

        Future<Void> result = dbQueue.submitTransaction(new DeleteIndexCallable(indexName));

        try {
            result.get();
        } catch (ExecutionException e) {
            String message = "Execution error during index deletion";
            logger.log(Level.SEVERE, message, e);
            throw new QueryException(message, e);
        } catch (InterruptedException e) {
            String message = "Execution interrupted error during index deletion";
            logger.log(Level.SEVERE, message, e);
            throw new QueryException(message, e);
        }

    }
1188976
public int columnIndex(String columnName) {
        for (int i = 0; i < columnCount(); i++) {
            if (columnNames().get(i).equalsIgnoreCase(columnName)) {
                return i;
            }
        }
        throw new IllegalArgumentException(String.format("Column %s is not present in table %s", columnName, name
                ()));
    }
530313
public boolean isExistingIndex(String index) throws IOException {
        logger.debug("is existing index [{}]", index);
        try {
            Response restResponse = lowLevelClient.performRequest("GET", "/" + index);
            logger.trace("get index metadata response: {}", asMap(restResponse));
            return true;
        } catch (ResponseException e) {
            if (e.getResponse().getStatusLine().getStatusCode() == 404) {
                logger.debug("index [{}] does not exist", index);
                return false;
            }
            throw e;
        }
    }
1132518
private void validateSchema(Schema schema) throws DDFException {
    Set<String> columnSet = new HashSet<String>();
    if(schema != null && schema.getColumns() != null) {
      for (Column column : schema.getColumns()) {
        if (columnSet.contains(column.getName())) {
          throw new DDFException(String.format("Duplicated column name %s", column.getName()));
        } else {
          columnSet.add(column.getName());
        }
      }
    }
  }
192654
private void addColumn(String storeName, String rowKey, String colName, byte[] colValue) {
        Map<String, Map<String, byte[]>> rowMap = m_columnAdds.get(storeName);
        if (rowMap == null) {
            rowMap = new HashMap<>();
            m_columnAdds.put(storeName, rowMap);
        }
        
        Map<String, byte[]> colMap = rowMap.get(rowKey);
        if (colMap == null) {
            colMap = new HashMap<>();
            rowMap.put(rowKey, colMap);
        }
        
        byte[] oldValue = colMap.put(colName, colValue);
        if (oldValue == null) {
            m_totalUpdates++;
        } else if (!Arrays.equals(oldValue, colValue)) {
            m_logger.debug("Warning: duplicate column mutation with different value: " +
                           "store={}, row={}, col={}, old={}, new={}",
                           new Object[]{storeName, rowKey, colName, oldValue, colValue});
        }
    }
1334683
protected void missingCheck(Integer index, String column) {
		if (index == null) {
			throw new GeoPackageException("No " + column
					+ " column was found for table '" + tableName + "'");
		}
	}
747845
public void addColumn(DefaultTableColumn column) {
        column.setModelIndex(columnModel.getColumnCount());
        columnModel.addColumn(column);
    }
177979
public static String getUniqueColumnName(String base, List<Column> columns) {
        String cursor = base;
        int cpt = 2;
        boolean findDuplicate= true;
        while(findDuplicate) {
            findDuplicate = false;
            for (Column column : columns) {
                if (column.getName().equalsIgnoreCase(cursor)) {
                    findDuplicate = true;
                    break;
                }
            }
            if(findDuplicate) {
                cursor = base + Integer.toString(cpt);
            }
        }
        return cursor;
    }
637183
public static void skipIndex(DataInput in) throws IOException
    {
        /* read only the column index list */
        int columnIndexSize = in.readInt();
        /* skip the column index data */
        if (in instanceof FileDataInput)
        {
            FileUtils.skipBytesFully(in, columnIndexSize);
        }
        else
        {
            // skip bytes
            byte[] skip = new byte[columnIndexSize];
            in.readFully(skip);
        }
    }