Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,10 @@ private static void binaryReaderMethodForType(MethodVisitor mv, Class<?> targetT
readerMethod = "readShortLE";
readerMethodReturnType = Type.getDescriptor(short.class);
break;
case Bool:
readerMethod = "readByte";
readerMethodReturnType = Type.getDescriptor(byte.class);
break;
default:
throw new ClientException("Column type '" + dataType + "' cannot be set to a primitive type '" + targetType + "'");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ public static String generateTableCreateSQL(String tableName) {
"decimal64 Decimal64(3), " +
"decimal128 Decimal128(4), " +
"decimal256 Decimal256(5), " +
"bool UInt8, " +
"bool Bool, " +
"string String, " +
"fixedString FixedString(3), " +
"date Date, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1800,13 +1800,20 @@ public void testConcurrentQueries() throws Exception{
@Test(groups = {"integration"})
public void testQueryReadToPOJO() {
int limit = 10;
final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', toString(number + 1)) as name " +
final String sql = "SELECT toInt32(rand32()) as id, toInt32(number * 10) as age, concat('name_', toString(number + 1)) as name, true as bool " +
" FROM system.numbers LIMIT " + limit;
TableSchema schema = client.getTableSchemaFromQuery(sql);
client.register(SimplePOJO.class, schema);

List<SimplePOJO> pojos = client.queryAll(sql, SimplePOJO.class, schema);
Assert.assertEquals(pojos.size(), limit);

for (SimplePOJO pojo : pojos) {
Assert.assertNotNull(pojo.getId());
Assert.assertNotNull(pojo.getAge());
Assert.assertNotNull(pojo.getName());
Assert.assertTrue(pojo.getBool());
}
}

@Test(groups = {"integration"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class SimplePOJO {

Integer age = null;

Boolean bool = false;

public long getId() {
return id;
}
Expand All @@ -33,12 +35,21 @@ public void setAge(Integer age) {
this.age = age;
}

public Boolean getBool() {
return bool;
}

public void setBool(Boolean bool) {
this.bool = bool;
}

@Override
public String toString() {
return "SimplePOJO{" +
"id=" + id +
", name='" + name + '\'' +
", age=" + age +
", bool=" + bool +
'}';
}
}
Loading