mirror of https://github.com/apache/druid.git
SQL: Fix selecting BOOLEAN type in JDBC. (#5401)
This commit is contained in:
parent
219e77aeac
commit
818ce51964
|
@ -385,6 +385,8 @@ public class QueryMaker
|
|||
return ColumnMetaData.Rep.of(Float.class);
|
||||
} else if (sqlType == SqlTypeName.DOUBLE || sqlType == SqlTypeName.DECIMAL) {
|
||||
return ColumnMetaData.Rep.of(Double.class);
|
||||
} else if (sqlType == SqlTypeName.BOOLEAN) {
|
||||
return ColumnMetaData.Rep.of(Boolean.class);
|
||||
} else if (sqlType == SqlTypeName.OTHER) {
|
||||
return ColumnMetaData.Rep.of(Object.class);
|
||||
} else {
|
||||
|
|
|
@ -41,12 +41,12 @@ import io.druid.java.util.common.Pair;
|
|||
import io.druid.java.util.common.StringUtils;
|
||||
import io.druid.math.expr.ExprMacroTable;
|
||||
import io.druid.server.DruidNode;
|
||||
import io.druid.server.security.NoopEscalator;
|
||||
import io.druid.server.security.AuthConfig;
|
||||
import io.druid.server.security.AuthTestUtils;
|
||||
import io.druid.server.security.AuthenticatorMapper;
|
||||
import io.druid.server.security.AuthorizerMapper;
|
||||
import io.druid.server.security.Escalator;
|
||||
import io.druid.server.security.NoopEscalator;
|
||||
import io.druid.sql.calcite.planner.Calcites;
|
||||
import io.druid.sql.calcite.planner.DruidOperatorTable;
|
||||
import io.druid.sql.calcite.planner.PlannerConfig;
|
||||
|
@ -287,6 +287,21 @@ public class DruidAvaticaHandlerTest
|
|||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectBoolean() throws Exception
|
||||
{
|
||||
final ResultSet resultSet = client.createStatement().executeQuery(
|
||||
"SELECT dim2, dim2 IS NULL AS isnull FROM druid.foo LIMIT 1"
|
||||
);
|
||||
|
||||
Assert.assertEquals(
|
||||
ImmutableList.of(
|
||||
ImmutableMap.of("dim2", "a", "isnull", false)
|
||||
),
|
||||
getRows(resultSet)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExplainSelectCount() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue