-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
422 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
regression-test/data/nereids_p0/javaudf/test_javaudf_ip.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
-- This file is automatically generated. You should know what you did if you want to edit this | ||
-- !select_ipv4_1 -- | ||
1 0.0.0.123 /0.0.0.123 | ||
2 0.0.12.42 /0.0.12.42 | ||
3 0.119.130.67 /0.119.130.67 | ||
4 \N null | ||
|
||
-- !select_ipv4_2 -- | ||
1 0.0.0.123 0.0.0.123 | ||
2 0.0.0.123 0.0.0.123 | ||
3 2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D 202.254.240.13 | ||
4 2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D 202.254.240.13 | ||
|
||
-- !select_ipv4_3 -- | ||
nulludf/0.0.0.123udf/0.0.12.42udf/0.119.130.67udf | ||
|
||
-- !select_ipv4_4 -- | ||
1 ["127.0.0.1", "127.0.0.1", "127.0.0.1", null, null, "127.0.0.1"] | ||
2 ["127.0.0.1", "127.0.0.1", "127.0.0.1", null, null, "127.0.0.1"] | ||
3 ["127.0.0.1", "127.0.0.1", "127.0.0.1", null, null, "127.0.0.1"] | ||
4 ["127.0.0.1", "127.0.0.1", "127.0.0.1", null, null, "127.0.0.1"] | ||
|
||
-- !select_ipv6_1 -- | ||
1 ::855d /0:0:0:0:0:0:0:855d | ||
2 ::0.4.221.183 /0:0:0:0:0:0:4:ddb7 | ||
3 ::a:7429:d0d6:6e08:9f5f /0:0:0:a:7429:d0d6:6e08:9f5f | ||
4 \N null | ||
|
||
-- !select_ipv6_2 -- | ||
1 0.0.0.123 ::7b | ||
2 0.0.0.123 ::7b | ||
3 2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D 2001:db8:ac10:fe01:feed:babe:cafe:f00d | ||
4 2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D 2001:db8:ac10:fe01:feed:babe:cafe:f00d | ||
|
||
-- !select_ipv6_4 -- | ||
1 ["::1", "::1", "::1", null, null, "::1"] | ||
2 ["::1", "::1", "::1", null, null, "::1"] | ||
3 ["::1", "::1", "::1", null, null, "::1"] | ||
4 ["::1", "::1", "::1", null, null, "::1"] | ||
|
54 changes: 54 additions & 0 deletions
54
regression-test/java-udf-src/src/main/java/org/apache/doris/udf/IPV4TypeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.apache.doris.udf; | ||
|
||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
import java.util.ArrayList; | ||
|
||
public class IPV4TypeTest { | ||
// input ipv4 | ||
public String evaluate(InetAddress x) { | ||
if (x == null) { | ||
return "null"; | ||
} | ||
return x.toString(); | ||
} | ||
|
||
// output ipv4 | ||
public InetAddress evaluate(String s) { | ||
try { | ||
InetAddress ipv4Address = InetAddress.getByName(s); | ||
return ipv4Address; | ||
} catch (UnknownHostException e) { | ||
return null; | ||
} | ||
} | ||
|
||
// input array<ipv4> | ||
public String evaluate(ArrayList<InetAddress> s) { | ||
String ret = ""; | ||
for (InetAddress ip : s) { | ||
ret += evaluate(ip) + "udf"; | ||
} | ||
return ret; | ||
} | ||
|
||
// output array<ipv4> | ||
public ArrayList<InetAddress> evaluate() { | ||
ArrayList<InetAddress> ret = new ArrayList<InetAddress>(); | ||
InetAddress DEFAULT_IPV = null; | ||
try { | ||
DEFAULT_IPV = InetAddress.getByName("127.0.0.1"); | ||
} catch (UnknownHostException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
|
||
ret.add(DEFAULT_IPV); | ||
ret.add(DEFAULT_IPV); | ||
ret.add(DEFAULT_IPV); | ||
ret.add(null); | ||
ret.add(null); | ||
ret.add(DEFAULT_IPV); | ||
return ret; | ||
} | ||
} |
Oops, something went wrong.