Browse Source

Merge pull request #876 from vrischmann/fix-table-metadata

metadata: key_aliases are only relevant with proto version 1
Chris Bannister 8 years ago
parent
commit
b7256b9551
2 changed files with 3 additions and 4 deletions
  1. 1 1
      cassandra_test.go
  2. 2 3
      metadata.go

+ 1 - 1
cassandra_test.go

@@ -1766,7 +1766,7 @@ func TestGetTableMetadata(t *testing.T) {
 	if testTable == nil {
 		t.Fatal("Expected table metadata for name 'test_table_metadata'")
 	}
-	if *flagProto < protoVersion4 {
+	if *flagProto == protoVersion1 {
 		if testTable.KeyValidator != "org.apache.cassandra.db.marshal.Int32Type" {
 			t.Errorf("Expected test_table_metadata key validator to be 'org.apache.cassandra.db.marshal.Int32Type' but was '%s'", testTable.KeyValidator)
 		}

+ 2 - 3
metadata.go

@@ -247,7 +247,7 @@ func compileMetadata(
 		table.OrderedColumns = append(table.OrderedColumns, columns[i].Name)
 	}
 
-	if protoVersion == 1 {
+	if protoVersion == protoVersion1 {
 		compileV1Metadata(tables)
 	} else {
 		compileV2Metadata(tables)
@@ -505,9 +505,8 @@ func getTableMetadata(session *Session, keyspaceName string) ([]TableMetadata, e
 			}
 			return r
 		}
-	} else if session.cfg.ProtoVersion < protoVersion4 {
+	} else if session.cfg.ProtoVersion == protoVersion1 {
 		// we have key aliases
-		// TODO: Do we need key_aliases?
 		stmt = `
 		SELECT
 			columnfamily_name,