Insert(TableMetadata table) { this( Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Delete(TableMetadata table, List<Selector> columns) { this( Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey(), columns); }
Update(TableMetadata table) { this( Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Truncate(TableMetadata table) { this( Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Select(TableMetadata table, List<Object> columnNames, boolean isDistinct, boolean isJson) { this( Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey(), columnNames, isDistinct, isJson); }
private static int[] computePkIndices(Metadata clusterMetadata, ColumnDefinitions boundColumns) { List<ColumnMetadata> partitionKeyColumns = null; int[] pkIndexes = null; KeyspaceMetadata km = clusterMetadata.getKeyspace(Metadata.quote(boundColumns.getKeyspace(0))); if (km != null) { TableMetadata tm = km.getTable(Metadata.quote(boundColumns.getTable(0))); if (tm != null) { partitionKeyColumns = tm.getPartitionKey(); pkIndexes = new int[partitionKeyColumns.size()]; for (int i = 0; i < pkIndexes.length; ++i) pkIndexes[i] = -1; } } // Note: we rely on the fact CQL queries cannot span multiple tables. If that change, we'll have // to get smarter. for (int i = 0; i < boundColumns.size(); i++) maybeGetIndex(boundColumns.getName(i), i, partitionKeyColumns, pkIndexes); return allSet(pkIndexes) ? pkIndexes : null; }
assertThat(tm.isVirtual()).isTrue(); assertThat(tm.getColumns().size()).isEqualTo(12); assertThat(tm.getPartitionKey().size()).isEqualTo(1); assertThat(tm.getPartitionKey().get(0).getName()).isEqualTo("address"); assertThat(tm.getClusteringColumns().size()).isEqualTo(1); assertThat(tm.getClusteringColumns().get(0).getName()).isEqualTo("port");
BuiltStatement(TableMetadata tableMetadata) { this.partitionKey = tableMetadata.getPartitionKey(); this.routingKey = new ByteBuffer[tableMetadata.getPartitionKey().size()]; this.keyspace = escapeId(tableMetadata.getKeyspace().getName()); }
Insert(TableMetadata table) { this(Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Update(TableMetadata table) { this(escapeId(table.getKeyspace().getName()), escapeId(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Truncate(TableMetadata table) { this(escapeId(table.getKeyspace().getName()), escapeId(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Select(TableMetadata table, List<Object> columnNames, boolean isDistinct, boolean isJson) { this(escapeId(table.getKeyspace().getName()), escapeId(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey(), columnNames, isDistinct, isJson); }
Insert(TableMetadata table) { this(escapeId(table.getKeyspace().getName()), escapeId(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
Select(TableMetadata table, List<Object> columnNames, boolean isDistinct, boolean isJson) { this(Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey(), columnNames, isDistinct, isJson); }
Truncate(TableMetadata table) { this(Metadata.quoteIfNecessary(table.getKeyspace().getName()), Metadata.quoteIfNecessary(table.getName()), Arrays.asList(new Object[table.getPartitionKey().size()]), table.getPartitionKey()); }
public RowIterator() { AbstractType type = partitioner.getTokenValidator(); ResultSet rs = session.execute(cqlQuery, type.compose(type.fromString(split.getStartToken())), type.compose(type.fromString(split.getEndToken())) ); for (ColumnMetadata meta : cluster.getMetadata().getKeyspace(quote(keyspace)).getTable(quote(cfName)).getPartitionKey()) partitionBoundColumns.put(meta.getName(), Boolean.TRUE); rows = rs.iterator(); }
public RowIterator() { AbstractType type = partitioner.getTokenValidator(); ResultSet rs = session.execute(cqlQuery, type.compose(type.fromString(split.getStartToken())), type.compose(type.fromString(split.getEndToken())) ); for (ColumnMetadata meta : cluster.getMetadata().getKeyspace(quote(keyspace)).getTable(quote(cfName)).getPartitionKey()) partitionBoundColumns.put(meta.getName(), Boolean.TRUE); rows = rs.iterator(); }
public RowIterator() { AbstractType type = partitioner.getTokenValidator(); ResultSet rs = session.execute(cqlQuery, type.compose(type.fromString(split.getStartToken())), type.compose(type.fromString(split.getEndToken())) ); for (ColumnMetadata meta : cluster.getMetadata().getKeyspace(quote(keyspace)).getTable(quote(cfName)).getPartitionKey()) partitionBoundColumns.put(meta.getName(), Boolean.TRUE); rows = rs.iterator(); }
DistinctKeyIterator() { AbstractType type = partitioner.getTokenValidator(); Object startToken = type.compose(type.fromString(split.getStartToken())); Object endToken = type.compose(type.fromString(split.getEndToken())); SimpleStatement statement = new SimpleStatement(cqlQuery, startToken, endToken); rowIterator = session.execute(statement).iterator(); for (ColumnMetadata meta : cluster.getMetadata().getKeyspace(quote(keyspace)).getTable(quote(cfName)).getPartitionKey()) { partitionBoundColumns.put(meta.getName(), Boolean.TRUE); } }
DistinctKeyIterator() { AbstractType type = partitioner.getTokenValidator(); Object startToken = type.compose(type.fromString(split.getStartToken())); Object endToken = type.compose(type.fromString(split.getEndToken())); SimpleStatement statement = new SimpleStatement(cqlQuery, startToken, endToken); rowIterator = session.execute(statement).iterator(); for (ColumnMetadata meta : cluster.getMetadata().getKeyspace(quote(keyspace)).getTable(quote(cfName)).getPartitionKey()) { partitionBoundColumns.put(meta.getName(), Boolean.TRUE); } }