forcedotcom / phoenix

BSD 3-Clause "New" or "Revised" License
558 stars 227 forks source link

what i upsert is difference with my select #674

Closed jaywong85 closed 10 years ago

jaywong85 commented 10 years ago

version : newest 3.0.0 build with trunk code

create table ddl : String ddl = "create table if not exists " + tableName + "("

upsert : String upsert = "UPSERT INTO " + tableName + " (varchar_pk,char_pk,int_column) VALUES (?, ?, ?)"; PreparedStatement prepareStmt = conn.prepareStatement(upsert); prepareStmt.setString(1, "varchar1"); prepareStmt.setString(2, "char1"); prepareStmt.setInt(3, 1); prepareStmt.executeUpdate();

select :

String query = "SELECT * FROM " + tableName; ResultSet rs = conn.createStatement().executeQuery(query); System.out.println(rs.getString(1)); System.out.println(rs.getString(2)); System.out.println(rs.getInt(3));

but the print is archar1 char1 1090650230

i'm so sorry. a important thing I did't point out

i had create a index. String indexDdl = "CREATE INDEX if not exists "+tableName+"_idx ON " + tableName + "(int_column) ";

the index value in hbase is : hbase(main):003:0> scan 'TEST4_IDX' ROW COLUMN+CELL \xC1\x02\x00varchar1\x00char1 column=_0:_0, timestamp=1388646353386, value= 1 row(s) in 0.0120 seconds

mravi commented 10 years ago

I tested this on v 3.0.0 and it works fine

capture

jaywong85 commented 10 years ago

will you test it used jdbc code.. as a result, I tested used jdbc

jaywong85 commented 10 years ago

tha same environment. but now the print is the same. i don't know why.

keep survey