Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function reverseDNSQuery is garbage, remove it. #58368

Closed
alexey-milovidov opened this issue Dec 30, 2023 · 0 comments · Fixed by #58369
Closed

The function reverseDNSQuery is garbage, remove it. #58368

alexey-milovidov opened this issue Dec 30, 2023 · 0 comments · Fixed by #58369

Comments

@alexey-milovidov
Copy link
Member

  1. The test has failed, because it depends on the environment. Read https://dubroy.com/blog/cold-blooded-software/
    https://s3.amazonaws.com/clickhouse-test-reports/0/ebd95586d223c28b87e257b71909e0970e47abd3/stateless_tests__msan__[1_6].html

  2. The function works incorrectly because it uses only the first row in a block:

milovidov-desktop :) SELECT reverseDNSQuery(arrayJoin(['1.0.0.1', '1.1.1.1']))

SELECT reverseDNSQuery(arrayJoin(['1.0.0.1', '1.1.1.1']))

Query id: f0a6b518-1ee3-465b-9b3a-cf0adb4a9e2c

┌─reverseDNSQuery(arrayJoin(['1.0.0.1', '1.1.1.1']))─┐
│ ['one.one.one.one']                                │
│ ['one.one.one.one']                                │
└────────────────────────────────────────────────────┘

2 rows in set. Elapsed: 0.015 sec. 

milovidov-desktop :) SELECT reverseDNSQuery(arrayJoin(['1.0.0.1', '0.0.0.0']))

SELECT reverseDNSQuery(arrayJoin(['1.0.0.1', '0.0.0.0']))

Query id: 51b35005-4820-4019-b58e-468fd8ab6b7b

┌─reverseDNSQuery(arrayJoin(['1.0.0.1', '0.0.0.0']))─┐
│ ['one.one.one.one']                                │
│ ['one.one.one.one']                                │
└────────────────────────────────────────────────────┘

2 rows in set. Elapsed: 0.001 sec.
  1. The function requires enabling it in the configuration file, but I doubt anyone will go that far.

  2. It does not support the IPv4 or IPv6 data types, but it is natural to expect:

milovidov-desktop :) SELECT reverseDNSQuery(arrayJoin(['0.0.0.0'::IPv4, '1.1.1.1'::IPv4]))

SELECT reverseDNSQuery(arrayJoin([CAST('0.0.0.0', 'IPv4'), CAST('1.1.1.1', 'IPv4')]))

Query id: 92458732-843d-4876-addb-3ba43f680f8e


Elapsed: 0.016 sec. 

Received exception from server (version 23.13.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Function reverseDNSQuery requires the input column to be of type String: while executing 'FUNCTION reverseDNSQuery(arrayJoin(array(CAST('0.0.0.0', 'IPv4'), CAST('1.1.1.1', 'IPv4'))) :: 1) -> reverseDNSQuery(arrayJoin(array(CAST('0.0.0.0', 'IPv4'), CAST('1.1.1.1', 'IPv4')))) Array(String) : 0'. (BAD_ARGUMENTS)
  1. It is difficult to use without reading the docs:
milovidov-desktop :) SELECT reverseDNSQuery(arrayJoin(['0.0.0.0', '1.1.1.1']))

SELECT reverseDNSQuery(arrayJoin(['0.0.0.0', '1.1.1.1']))

Query id: f7425fd9-ac7b-447f-a7dc-bc4eae6a7e4c


Elapsed: 0.015 sec. 

Received exception:
Code: 446. DB::Exception: Function reverseDNSQuery is not allowed because allow_reverse_dns_query_function is not set. (FUNCTION_NOT_ALLOWED)

milovidov-desktop :) SET allow_reverse_dns_query_function = 1

SET allow_reverse_dns_query_function = 1

Query id: 8b4901b8-db44-4d45-9164-ad9710f1dae2


Elapsed: 0.019 sec. 

Received exception:
Code: 115. DB::Exception: Unknown setting allow_reverse_dns_query_function. (UNKNOWN_SETTING)
  1. Finally, there is no motivation to have it as an embedded function rather than UDF.

We overlooked it during the code review. We apologize for that. #45629

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant