在phoenix中建表遇到下面的异常信息:
java.sql.SQLException: ERROR 1004 (42J02): Order of columns in primary key constraint must match the order in which they're declared. columnName=COE.SP_BASIC_CHUGUAN.KDANHAO at com.salesforce.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:146) at com.salesforce.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:646) at com.salesforce.phoenix.schema.MetaDataClient.createTable(MetaDataClient.java:338) at com.salesforce.phoenix.compile.CreateTableCompiler$1.execute(CreateTableCompiler.java:83) at com.salesforce.phoenix.jdbc.PhoenixStatement$ExecutableCreateTableStatement.executeUpdate(PhoenixStatement.java:357) at com.salesforce.phoenix.jdbc.PhoenixStatement$ExecutableCreateTableStatement.execute(PhoenixStatement.java:350) at com.salesforce.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1014) at com.jd.coo.jconsole.App.executeSQL(App.java:123) at com.jd.coo.jconsole.App.main(App.java:77)
很容易理解是说列的顺序和主键中指定的列顺序不一致了。建表的时候要特别注意列的顺序,必须和主键中出现的顺序是一致的。