mirror of https://github.com/apache/druid.git
fix ipv4_parse function return type in SQL to be bigint instead of integer (#16942)
* fix ipv4_parse function return type in SQL to be bigint instead of integer * fix default value mode
This commit is contained in:
parent
bce60b0674
commit
2aef6ac685
|
@ -39,7 +39,7 @@ public class IPv4AddressParseOperatorConversion extends DirectOperatorConversion
|
|||
OperandTypes.family(SqlTypeFamily.STRING),
|
||||
OperandTypes.family(SqlTypeFamily.INTEGER)
|
||||
))
|
||||
.returnTypeNullable(SqlTypeName.INTEGER)
|
||||
.returnTypeNullable(SqlTypeName.BIGINT)
|
||||
.functionCategory(SqlFunctionCategory.USER_DEFINED_FUNCTION)
|
||||
.build();
|
||||
|
||||
|
|
|
@ -16128,7 +16128,31 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||
.resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
|
||||
.build()
|
||||
),
|
||||
ImmutableList.of(NullHandling.sqlCompatible() ? new Object[]{null} : new Object[]{0})
|
||||
ImmutableList.of(NullHandling.sqlCompatible() ? new Object[]{null} : new Object[]{0L})
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIpv4ParseWithBigintOutput()
|
||||
{
|
||||
testQuery(
|
||||
"select ipv4_parse('192.168.0.1') from (values(1)) as t(col)",
|
||||
ImmutableList.of(
|
||||
Druids.newScanQueryBuilder()
|
||||
.dataSource(InlineDataSource.fromIterable(
|
||||
ImmutableList.of(new Object[]{1L}),
|
||||
RowSignature.builder()
|
||||
.add("col", ColumnType.LONG)
|
||||
.build()
|
||||
))
|
||||
.intervals(querySegmentSpec(Filtration.eternity()))
|
||||
.columns("v0")
|
||||
.virtualColumns(expressionVirtualColumn("v0", "3232235521", ColumnType.LONG))
|
||||
.context(QUERY_CONTEXT_DEFAULT)
|
||||
.resultFormat(ResultFormat.RESULT_FORMAT_COMPACTED_LIST)
|
||||
.build()
|
||||
),
|
||||
ImmutableList.of(new Object[]{3232235521L})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue