diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/IPv4AddressParseOperatorConversion.java b/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/IPv4AddressParseOperatorConversion.java index 297f10c63ad0..e4ad6e796b3b 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/IPv4AddressParseOperatorConversion.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/expression/builtin/IPv4AddressParseOperatorConversion.java @@ -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(); diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java index 7566d7f77863..556b437e7581 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/CalciteQueryTest.java @@ -16128,7 +16128,31 @@ public void testIpv4ParseWithNullableType() .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}) ); }