use of com.scalar.db.api.TableMetadata in project scalardb by scalar-labs.
the class MultiStorageAdminIntegrationTest method getTableMetadata_ForTable2InNamespace1_ShouldReturnMetadataFromStorage2.
@Test
public void getTableMetadata_ForTable2InNamespace1_ShouldReturnMetadataFromStorage2() throws ExecutionException {
// Arrange
String namespace = NAMESPACE1;
String table = TABLE2;
// Act
TableMetadata tableMetadata = multiStorageAdmin.getTableMetadata(namespace, table);
// Assert
assertThat(tableMetadata).isNotNull();
assertThat(tableMetadata.getPartitionKeyNames().size()).isEqualTo(1);
assertThat(tableMetadata.getPartitionKeyNames().iterator().next()).isEqualTo(COL_NAME1);
assertThat(tableMetadata.getClusteringKeyNames()).isEmpty();
assertThat(tableMetadata.getColumnNames().size()).isEqualTo(3);
assertThat(tableMetadata.getColumnNames().contains(COL_NAME1)).isTrue();
assertThat(tableMetadata.getColumnNames().contains(COL_NAME2)).isTrue();
assertThat(tableMetadata.getColumnNames().contains(COL_NAME3)).isTrue();
assertThat(tableMetadata.getColumnDataType(COL_NAME1)).isEqualTo(DataType.TEXT);
assertThat(tableMetadata.getColumnDataType(COL_NAME2)).isEqualTo(DataType.INT);
assertThat(tableMetadata.getColumnDataType(COL_NAME3)).isEqualTo(DataType.BOOLEAN);
assertThat(tableMetadata.getClusteringOrder(COL_NAME1)).isNull();
assertThat(tableMetadata.getClusteringOrder(COL_NAME2)).isNull();
assertThat(tableMetadata.getClusteringOrder(COL_NAME3)).isNull();
assertThat(tableMetadata.getSecondaryIndexNames()).isEmpty();
}
use of com.scalar.db.api.TableMetadata in project scalardb by scalar-labs.
the class MultiStorageAdminIntegrationTest method getTableMetadata_ForTable1InNamespace2_ShouldReturnMetadataFromStorage2.
@Test
public void getTableMetadata_ForTable1InNamespace2_ShouldReturnMetadataFromStorage2() throws ExecutionException {
// Arrange
String namespace = NAMESPACE2;
String table = TABLE1;
// Act
TableMetadata tableMetadata = multiStorageAdmin.getTableMetadata(namespace, table);
// Assert
assertThat(tableMetadata).isNotNull();
assertThat(tableMetadata.getPartitionKeyNames().size()).isEqualTo(1);
assertThat(tableMetadata.getPartitionKeyNames().iterator().next()).isEqualTo(COL_NAME1);
assertThat(tableMetadata.getClusteringKeyNames()).isEmpty();
assertThat(tableMetadata.getColumnNames().size()).isEqualTo(3);
assertThat(tableMetadata.getColumnNames().contains(COL_NAME1)).isTrue();
assertThat(tableMetadata.getColumnNames().contains(COL_NAME2)).isTrue();
assertThat(tableMetadata.getColumnNames().contains(COL_NAME3)).isTrue();
assertThat(tableMetadata.getColumnDataType(COL_NAME1)).isEqualTo(DataType.TEXT);
assertThat(tableMetadata.getColumnDataType(COL_NAME2)).isEqualTo(DataType.INT);
assertThat(tableMetadata.getColumnDataType(COL_NAME3)).isEqualTo(DataType.BOOLEAN);
assertThat(tableMetadata.getClusteringOrder(COL_NAME1)).isNull();
assertThat(tableMetadata.getClusteringOrder(COL_NAME2)).isNull();
assertThat(tableMetadata.getClusteringOrder(COL_NAME3)).isNull();
assertThat(tableMetadata.getSecondaryIndexNames()).isEmpty();
}
use of com.scalar.db.api.TableMetadata in project scalardb by scalar-labs.
the class CosmosAdmin method dropIndex.
@Override
public void dropIndex(String namespace, String table, String columnName) throws ExecutionException {
TableMetadata tableMetadata = getTableMetadata(namespace, table);
TableMetadata newTableMetadata = TableMetadata.newBuilder(tableMetadata).removeSecondaryIndex(columnName).build();
updateIndexingPolicy(namespace, table, newTableMetadata);
// update metadata
putTableMetadata(namespace, table, newTableMetadata);
}
use of com.scalar.db.api.TableMetadata in project scalardb by scalar-labs.
the class OperationChecker method check.
public void check(Put put) throws ExecutionException {
TableMetadata metadata = getMetadata(put);
checkPrimaryKey(put, metadata);
checkColumnsInPut(put, metadata);
checkCondition(put, metadata);
}
use of com.scalar.db.api.TableMetadata in project scalardb by scalar-labs.
the class OperationChecker method check.
public void check(ScanAll scanAll) throws ExecutionException {
TableMetadata metadata = getMetadata(scanAll);
checkProjections(scanAll, metadata);
if (scanAll.getLimit() < 0) {
throw new IllegalArgumentException("The limit cannot be negative. Operation: " + scanAll);
}
}
Aggregations