/** * Set the values of the index row based on a sql row. If an index column is * missing from the sql row it is replaced with an explicit null. (This * method is intended for insert) * * @param row SQL row * @param indexName Columns in the index * @param tableSchema Table schema * @return The current builder instance */ public IndexRowKeyBuilder withRow(Row row, String indexName, TableSchema tableSchema) { checkNotNull(row, "row must not be null."); Map<String, ByteBuffer> recordCopy = Maps.newHashMap(row.getRecords()); for (String column : tableSchema.getIndexSchema(indexName).getColumns()) { if (!recordCopy.containsKey(column)) { recordCopy.put(column, null); } } this.fields = recordCopy; this.indexName = indexName; this.tableSchema = tableSchema; return this; }
/** * Remove an index schema from the table schema * * @param indexName Name of index schema [Not null, Not empty] */ public void removeIndex(String indexName) { Verify.isNotNullOrEmpty(indexName); IndexSchema schema = getIndexSchema(indexName); checkNotNull(schema); indices.remove(schema); avroTableSchema.getIndices().remove(indexName); if (schema.getIsUnique()) { uniqueIndexCount--; } }
List<byte[]> encodedRecords = Lists.newArrayList(); if (fields != null) { for (String column : tableSchema.getIndexSchema(indexName).getColumns()) { if (!fields.containsKey(column)) { continue;
/** * Drop the index specified by the index name from the table. The table must be open * before this operation can be performed. * * @param indexName The name of the index to add, not null or empty */ public void dropIndex(String indexName) { Verify.isNotNullOrEmpty(indexName, "The index name is invalid"); checkTableOpen(); TableSchema tableSchema = store.getSchema(tableName); IndexSchema indexSchema = tableSchema.getIndexSchema(indexName); table.deleteTableIndex(indexSchema); store.dropIndex(tableName, indexName); }
IndexSchema indexSchema = schema.getIndexSchema(indexName);