File tree Expand file tree Collapse file tree 8 files changed +31
-10
lines changed
pipelines/processors/transforms Expand file tree Collapse file tree 8 files changed +31
-10
lines changed Original file line number Diff line number Diff line change 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
15
+ //! The compilation artefact of this crate cannot be cached, so to avoid long ci compilation times,
16
+ //! you should avoid introducing this crate in the underlying crate.
17
+
15
18
use std:: sync:: LazyLock ;
16
19
17
20
use semver:: Version ;
@@ -52,6 +55,9 @@ pub static DATABEND_SEMVER: LazyLock<Version> = LazyLock::new(|| {
52
55
Version :: parse ( semver) . unwrap_or_else ( |e| panic ! ( "Invalid semver: {:?}: {}" , semver, e) )
53
56
} ) ;
54
57
58
+ pub static UDF_CLIENT_USER_AGENT : LazyLock < String > =
59
+ LazyLock :: new ( || format ! ( "databend-query/{}" , * DATABEND_SEMVER ) ) ;
60
+
55
61
pub static DATABEND_COMMIT_VERSION : LazyLock < String > = LazyLock :: new ( || {
56
62
let semver = DATABEND_GIT_SEMVER ;
57
63
let git_sha = VERGEN_GIT_SHA ;
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ databend-common-exception = { workspace = true }
28
28
databend-common-grpc = { workspace = true }
29
29
databend-common-hashtable = { workspace = true }
30
30
databend-common-io = { workspace = true }
31
- databend-common-version = { workspace = true }
32
31
educe = { workspace = true }
33
32
either = { workspace = true }
34
33
enum-as-inner = { workspace = true }
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ use databend_common_base::headers::HEADER_TENANT;
29
29
use databend_common_exception:: ErrorCode ;
30
30
use databend_common_exception:: Result ;
31
31
use databend_common_grpc:: DNSService ;
32
- use databend_common_version:: DATABEND_SEMVER ;
33
32
use futures:: stream;
34
33
use futures:: StreamExt ;
35
34
use futures:: TryStreamExt ;
@@ -65,13 +64,14 @@ impl UDFFlightClient {
65
64
addr : & str ,
66
65
conn_timeout : u64 ,
67
66
request_timeout : u64 ,
67
+ user_agent : & str ,
68
68
) -> Result < Arc < Endpoint > > {
69
69
let tls_config = ClientTlsConfig :: new ( ) . with_native_roots ( ) ;
70
70
let endpoint = Endpoint :: from_shared ( addr. to_string ( ) )
71
71
. map_err ( |err| {
72
72
ErrorCode :: UDFServerConnectError ( format ! ( "Invalid UDF Server address: {err}" ) )
73
73
} ) ?
74
- . user_agent ( format ! ( "databend-query/{}" , * DATABEND_SEMVER ) )
74
+ . user_agent ( user_agent )
75
75
. map_err ( |err| {
76
76
ErrorCode :: UDFServerConnectError ( format ! ( "Invalid UDF Client User Agent: {err}" ) )
77
77
} ) ?
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ use databend_common_metrics::external_server::record_running_requests_external_f
41
41
use databend_common_metrics:: external_server:: record_running_requests_external_start;
42
42
use databend_common_pipeline_transforms:: processors:: AsyncTransform ;
43
43
use databend_common_sql:: executor:: physical_plans:: UdfFunctionDesc ;
44
+ use databend_common_version:: UDF_CLIENT_USER_AGENT ;
44
45
use tokio:: sync:: Semaphore ;
45
46
use tonic:: transport:: Endpoint ;
46
47
@@ -81,8 +82,12 @@ impl TransformUdfServer {
81
82
if endpoints. contains_key ( server_addr) {
82
83
continue ;
83
84
}
84
- let endpoint =
85
- UDFFlightClient :: build_endpoint ( server_addr, connect_timeout, request_timeout) ?;
85
+ let endpoint = UDFFlightClient :: build_endpoint (
86
+ server_addr,
87
+ connect_timeout,
88
+ request_timeout,
89
+ UDF_CLIENT_USER_AGENT . as_str ( ) ,
90
+ ) ?;
86
91
endpoints. insert ( server_addr. clone ( ) , endpoint) ;
87
92
}
88
93
Ok ( endpoints)
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ use databend_common_meta_app::schema::TableMeta;
52
52
use databend_common_pipeline_core:: Pipeline ;
53
53
use databend_common_pipeline_sources:: OneBlockSource ;
54
54
use databend_common_storages_factory:: Table ;
55
+ use databend_common_version:: UDF_CLIENT_USER_AGENT ;
55
56
use url:: Url ;
56
57
57
58
pub struct UdfEchoTable {
@@ -142,8 +143,12 @@ impl Table for UdfEchoTable {
142
143
let connect_timeout = settings. get_external_server_connect_timeout_secs ( ) ?;
143
144
let request_timeout = settings. get_external_server_request_timeout_secs ( ) ?;
144
145
145
- let endpoint =
146
- UDFFlightClient :: build_endpoint ( & self . address , connect_timeout, request_timeout) ?;
146
+ let endpoint = UDFFlightClient :: build_endpoint (
147
+ & self . address ,
148
+ connect_timeout,
149
+ request_timeout,
150
+ UDF_CLIENT_USER_AGENT . as_str ( ) ,
151
+ ) ?;
147
152
let mut client = UDFFlightClient :: connect ( endpoint, connect_timeout, 65536 )
148
153
. await ?
149
154
. with_tenant ( ctx. get_tenant ( ) . tenant_name ( ) ) ?
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ databend-common-storage = { workspace = true }
30
30
databend-common-storages-result-cache = { workspace = true }
31
31
databend-common-storages-view = { workspace = true }
32
32
databend-common-users = { workspace = true }
33
+ databend-common-version = { workspace = true }
33
34
databend-enterprise-data-mask-feature = { workspace = true }
34
35
databend-storages-common-cache = { workspace = true }
35
36
databend-storages-common-io = { workspace = true }
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ use databend_common_meta_app::principal::UDFDefinition as PlanUDFDefinition;
32
32
use databend_common_meta_app:: principal:: UDFScript ;
33
33
use databend_common_meta_app:: principal:: UDFServer ;
34
34
use databend_common_meta_app:: principal:: UserDefinedFunction ;
35
+ use databend_common_version:: UDF_CLIENT_USER_AGENT ;
35
36
36
37
use crate :: normalize_identifier;
37
38
use crate :: optimizer:: ir:: SExpr ;
@@ -105,8 +106,12 @@ impl Binder {
105
106
. get_settings ( )
106
107
. get_external_server_request_batch_rows ( ) ? as usize ;
107
108
108
- let endpoint =
109
- UDFFlightClient :: build_endpoint ( address, connect_timeout, request_timeout) ?;
109
+ let endpoint = UDFFlightClient :: build_endpoint (
110
+ address,
111
+ connect_timeout,
112
+ request_timeout,
113
+ UDF_CLIENT_USER_AGENT . as_str ( ) ,
114
+ ) ?;
110
115
111
116
let mut client = UDFFlightClient :: connect ( endpoint, connect_timeout, batch_rows)
112
117
. await ?
You can’t perform that action at this time.
0 commit comments