Revert "stuff"

This reverts commit 1b7dd8fd3c.
This commit is contained in:
Zoltan Haindrich 2024-06-26 10:07:48 +00:00
parent 1b7dd8fd3c
commit e7141e2080
3 changed files with 3 additions and 23 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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();
}
}