mirror of https://github.com/apache/druid.git
parent
1b7dd8fd3c
commit
e7141e2080
|
@ -722,9 +722,7 @@ public class NestedDataOperatorConversions
|
|||
public static class JsonObjectOperatorConversion implements SqlOperatorConversion
|
||||
{
|
||||
private static final String FUNCTION_NAME = "json_object";
|
||||
private static final SqlFunction SQL_FUNCTION = SqlStdOperatorTable.JSON_OBJECT;
|
||||
|
||||
private static final SqlFunction SQL_FUNCTION0 = OperatorConversions
|
||||
private static final SqlFunction SQL_FUNCTION = OperatorConversions
|
||||
.operatorBuilder(FUNCTION_NAME)
|
||||
.operandTypeChecker(OperandTypes.variadic(SqlOperandCountRanges.from(1)))
|
||||
.operandTypeInference((callBinding, returnType, operandTypes) -> {
|
||||
|
@ -783,8 +781,7 @@ public class NestedDataOperatorConversions
|
|||
public static class ToJsonStringOperatorConversion implements SqlOperatorConversion
|
||||
{
|
||||
private static final String FUNCTION_NAME = "to_json_string";
|
||||
private static final SqlFunction SQL_FUNCTION =
|
||||
OperatorConversions
|
||||
private static final SqlFunction SQL_FUNCTION = OperatorConversions
|
||||
.operatorBuilder(StringUtils.toUpperCase(FUNCTION_NAME))
|
||||
.operandTypes(SqlTypeFamily.ANY)
|
||||
.returnTypeCascadeNullable(SqlTypeName.VARCHAR)
|
||||
|
|
|
@ -4882,7 +4882,7 @@ public class CalciteNestedDataQueryTest extends BaseCalciteQueryTest
|
|||
public void testJsonQueryAndJsonObject()
|
||||
{
|
||||
testQuery(
|
||||
"SELECT TO_JSON_STRING(JSON_OBJECT(KEY 'n' VALUE JSON_QUERY(nester, '$.n'), KEY 'x' VALUE JSON_VALUE(nest, '$.x')))\n"
|
||||
"SELECT JSON_OBJECT(KEY 'n' VALUE JSON_QUERY(nester, '$.n'), KEY 'x' VALUE JSON_VALUE(nest, '$.x'))\n"
|
||||
+ "FROM druid.nested",
|
||||
ImmutableList.of(
|
||||
Druids.newScanQueryBuilder()
|
||||
|
|
|
@ -97,21 +97,4 @@ public class CalciteSysQueryTest extends BaseCalciteQueryTest
|
|||
+ " LogicalTableScan(table=[[sys, tasks]])\n")
|
||||
.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonObject()
|
||||
{
|
||||
testBuilder()
|
||||
.sql(
|
||||
"select JSON_OBJECT('name': COLUMN_NAME, 'type': \"DATA_TYPE\")"
|
||||
+ "from INFORMATION_SCHEMA.COLUMNS order by COLUMN_NAME limit 1"
|
||||
)
|
||||
.expectedResults(
|
||||
ImmutableList.of(
|
||||
new Object[] {"{\"name\":\"CATALOG_NAME\",\"type\":\"VARCHAR\"}"}
|
||||
)
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue