Add missing topLevelDomainRFC

This commit is contained in:
Blargian 2024-05-28 09:02:21 +02:00
parent 3415e07186
commit 304dc52b3a

View File

@ -79,8 +79,9 @@ topLevelDomain(url)
**Arguments**
- `url` — URL. Type: [String](../../sql-reference/data-types/string.md).
- `url` — URL. [String](../../sql-reference/data-types/string.md).
:::note
The URL can be specified with or without a scheme. Examples:
``` text
@ -88,26 +89,70 @@ svn+ssh://some.svn-hosting.com:80/repo/trunk
some.svn-hosting.com:80/repo/trunk
https://clickhouse.com/time/
```
:::
**Returned values**
- Domain name. If ClickHouse can parse the input string as a URL.
- Empty string. If ClickHouse cannot parse the input string as a URL.
Type: `String`.
- Domain name if ClickHouse can parse the input string as a URL. Otherwise, an empty string. [String](../../sql-reference/data-types/string.md).
**Example**
Query:
``` sql
SELECT topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk');
```
Result:
``` text
┌─topLevelDomain('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐
│ com │
└────────────────────────────────────────────────────────────────────┘
```
### topLevelDomainRFC
Extracts the the top-level domain from a URL. It is similar to [topLevelDomain](#topleveldomain), but conforms to RFC 3986.
``` sql
topLevelDomainRFC(url)
```
**Arguments**
- `url` — URL. [String](../../sql-reference/data-types/string.md).
:::note
The URL can be specified with or without a scheme. Examples:
``` text
svn+ssh://some.svn-hosting.com:80/repo/trunk
some.svn-hosting.com:80/repo/trunk
https://clickhouse.com/time/
```
:::
**Returned values**
- Domain name if ClickHouse can parse the input string as a URL. Otherwise, an empty string. [String](../../sql-reference/data-types/string.md).
**Example**
Query:
``` sql
SELECT topLevelDomainRFC('svn+ssh://www.some.svn-hosting.com:80/repo/trunk');
```
Result:
``` text
┌─topLevelDomainRFC('svn+ssh://www.some.svn-hosting.com:80/repo/trunk')─┐
│ com │
└───────────────────────────────────────────────────────────────────────┘
```
### firstSignificantSubdomain
Returns the “first significant subdomain”. The first significant subdomain is a second-level domain if it is com, net, org, or co. Otherwise, it is a third-level domain. For example, `firstSignificantSubdomain (https://news.clickhouse.com/) = clickhouse, firstSignificantSubdomain (https://news.clickhouse.com.tr/) = clickhouse`. The list of “insignificant” second-level domains and other implementation details may change in the future.