public static List<ColumnDefinition> getIndexMetadata( String indexes ) { if ( indexes == null ) { return null; } String[] index_entries = split( indexes, ',' ); List<ColumnDef> columns = new ArrayList<ColumnDef>(); for ( String index_entry : index_entries ) { String column_name = stringOrSubstringBeforeFirst( index_entry, ':' ).trim(); String comparer = substringAfterLast( index_entry, ":" ).trim(); if ( StringUtils.isBlank( comparer ) ) { comparer = "UUIDType"; } if ( StringUtils.isNotBlank( column_name ) ) { ColumnDef cd = new ColumnDef( bytebuffer( column_name ), comparer ); cd.setIndex_name( column_name ); cd.setIndex_type( IndexType.KEYS ); columns.add( cd ); } } return ThriftColumnDef.fromThriftList( columns ); }
private ColumnDef toThrift() { ColumnDef d = new ColumnDef(); if ( indexName != null ) { d.setIndex_name(indexName); d.setIndex_type(indexTypeToThrift(indexType)); } d.setName(name); d.setValidation_class(validationClass); return d; }
ColumnDef columnDef = new ColumnDef(); if (columnInfo.isIndexable())
ColumnDef newIndexedColumnDef(String column_name, String comparer) { ColumnDef cd = new ColumnDef(se.toByteBuffer(column_name), comparer); cd.setIndex_name(column_name); cd.setIndex_type(IndexType.KEYS); return cd; }
user_Def.setDefault_validation_class("UTF8Type"); user_Def.setKey_validation_class("UTF8Type"); ColumnDef columnDef = new ColumnDef(ByteBuffer.wrap("birth_date".getBytes()), "Int32Type"); columnDef.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(columnDef); ColumnDef columnDef1 = new ColumnDef(ByteBuffer.wrap("state".getBytes()), "UTF8Type"); columnDef1.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(columnDef1); ColumnDef columnDef2 = new ColumnDef(ByteBuffer.wrap("full_name".getBytes()), "UTF8Type"); columnDef2.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(columnDef2);
/** * Sets the up. * * @throws Exception * the exception */ @Before public void setUp() throws Exception { CassandraCli.cassandraSetUp(); CassandraCli.createKeySpace("KunderaExamples"); Cassandra.Client client = CassandraCli.getClient(); client.set_keyspace("KunderaExamples"); CfDef cf_def = new CfDef(); cf_def.keyspace = "KunderaExamples"; cf_def.name = "users"; cf_def.setKey_validation_class("UTF8Type"); ColumnDef columnDef2 = new ColumnDef(ByteBuffer.wrap("full_name".getBytes()), "UTF8Type"); columnDef2.index_type = IndexType.KEYS; cf_def.addToColumn_metadata(columnDef2); ColumnDef columnDef3 = new ColumnDef(ByteBuffer.wrap("birth_date".getBytes()), "Int32Type"); columnDef3.index_type = IndexType.KEYS; cf_def.addToColumn_metadata(columnDef3); ColumnDef columnDef4 = new ColumnDef(ByteBuffer.wrap("state".getBytes()), "UTF8Type"); columnDef4.index_type = IndexType.KEYS; cf_def.addToColumn_metadata(columnDef4); client.system_add_column_family(cf_def); }
private void createSchema() throws InvalidRequestException, TException, SchemaDisagreementException { Client client = CassandraCli.getClient(); CassandraCli.createKeySpace(keyspace); client.set_keyspace(keyspace); CfDef cfDef = new CfDef(); cfDef.keyspace = keyspace; cfDef.name = "counters"; cfDef.default_validation_class = "CounterColumnType"; cfDef.key_validation_class = "UTF8Type"; ColumnDef columnDef = new ColumnDef(ByteBuffer.wrap("counter".getBytes()), "CounterColumnType"); columnDef.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(columnDef); cfDef.comparator_type = "UTF8Type"; client.system_add_column_family(cfDef); }
ColumnDef columnDef = new ColumnDef(); if (columnInfo.isIndexable())
cf_def.name = "uuidsample"; cf_def.setKey_validation_class("UUIDType"); ColumnDef columnDef2 = new ColumnDef(ByteBuffer.wrap("name".getBytes()), "UTF8Type"); columnDef2.index_type = IndexType.KEYS; cf_def.addToColumn_metadata(columnDef2); ColumnDef columnDef3 = new ColumnDef(ByteBuffer.wrap("age".getBytes()), "Int32Type"); columnDef3.index_type = IndexType.KEYS; cf_def.addToColumn_metadata(columnDef3);
cfDef.setComparator_type("UTF8Type"); cfDef.setKey_validation_class("UTF8Type"); ColumnDef columnDef = new ColumnDef(ByteBuffer.wrap("first_name".getBytes()), "UTF8Type"); columnDef.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(columnDef); ColumnDef columnDef1 = new ColumnDef(ByteBuffer.wrap("last_name".getBytes()), "UTF8Type"); columnDef1.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(columnDef1); ColumnDef columnDef2 = new ColumnDef(ByteBuffer.wrap("age".getBytes()), "Int32Type"); columnDef2.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(columnDef2);
professionalCfDef.setKey_validation_class("UTF8Type"); ColumnDef departmentDef = new ColumnDef(ByteBuffer.wrap("DEPARTMENT_ID".getBytes()), "LongType"); departmentDef.index_type = IndexType.KEYS; ColumnDef exceptionalDef = new ColumnDef(ByteBuffer.wrap("IS_EXCEPTIONAL".getBytes()), "BooleanType"); exceptionalDef.index_type = IndexType.KEYS; ColumnDef enrolmentDateDef = new ColumnDef(ByteBuffer.wrap("ENROLMENT_DATE".getBytes()), "DateType"); enrolmentDateDef.index_type = IndexType.KEYS;
cfDef.setKey_validation_class("Int32Type"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
/** * getColumnMetadata use for getting column metadata for specific * columnInfo. * * @param columnInfo * the column info * @param tableInfo * the table info * @return the column metadata */ private ColumnDef getColumnMetadata(ColumnInfo columnInfo, TableInfo tableInfo) { ColumnDef columnDef = new ColumnDef(); columnDef.setName(columnInfo.getColumnName().getBytes()); columnDef.setValidation_class(CassandraValidationClassMapper.getValidationClass(columnInfo.getType(), isCql3Enabled(tableInfo))); if (columnInfo.isIndexable()) { IndexInfo indexInfo = tableInfo.getColumnToBeIndexed(columnInfo.getColumnName()); columnDef.setIndex_type(CassandraIndexHelper.getIndexType(indexInfo.getIndexType())); // if (!indexInfo.getIndexName().equals(indexInfo.getColumnName())) // { // columnDef.setIndex_name(indexInfo.getIndexName()); // } } return columnDef; }
user_Def.setDefault_validation_class("UTF8Type"); user_Def.setKey_validation_class("UTF8Type"); ColumnDef columnDef = new ColumnDef(ByteBuffer.wrap("PERSON_ID".getBytes()), "UTF8Type"); columnDef.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(columnDef); ColumnDef columnDef1 = new ColumnDef(ByteBuffer.wrap("ADDRESS_ID".getBytes()), "UTF8Type"); columnDef1.index_type = IndexType.KEYS; user_Def.addToColumn_metadata(columnDef1);
cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "IntegerType"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
cfDef.setKey_validation_class("DoubleType"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
cfDef.setKey_validation_class("IntegerType"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
cfDef.setKey_validation_class("FloatType"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
cfDef.setKey_validation_class("Int32Type"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);
cfDef.setKey_validation_class("Int32Type"); cfDef.setComparator_type("UTF8Type"); ColumnDef name = new ColumnDef(ByteBuffer.wrap("NAME".getBytes()), "UTF8Type"); name.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(name); ColumnDef age = new ColumnDef(ByteBuffer.wrap("AGE".getBytes()), "Int32Type"); age.index_type = IndexType.KEYS; cfDef.addToColumn_metadata(age);