Skip to content

Commit 0a7747f

Browse files
committed
chore: rebase
1 parent 027b951 commit 0a7747f

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/meta/app/src/principal/user_defined_function.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,15 @@ pub struct UDFScript {
5151
pub immutable: Option<bool>,
5252
}
5353

54+
/// User Defined Table Function (UDTF)
55+
///
56+
/// # Fields
57+
/// - `arg_types`: arg name with data type
58+
/// - `return_types`: return column name with data type
59+
/// - `sql`: SQL implementing the UDTF
5460
#[derive(Clone, Debug, Eq, PartialEq)]
5561
pub struct UDTF {
56-
// arg name with data type
5762
pub arg_types: Vec<(String, DataType)>,
58-
// return column name with data type
5963
pub return_types: Vec<(String, DataType)>,
6064
pub sql: String,
6165
}

src/meta/proto-conv/src/udf_from_to_protobuf_impl.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,20 @@ impl FromToProto for mt::UDTF {
289289

290290
let mut arg_types = Vec::new();
291291
for arg_ty in p.arg_types {
292-
let ty = TableDataType::from_pb(arg_ty.ty.ok_or_else(|| {
292+
let ty_pb = arg_ty.ty.ok_or_else(|| {
293293
Incompatible::new("UDTF.arg_types.ty can not be None".to_string())
294-
})?)?;
294+
})?;
295+
let ty = TableDataType::from_pb(ty_pb)?;
295296

296297
arg_types.push((arg_ty.name, (&ty).into()));
297298
}
298299

299300
let mut return_types = Vec::new();
300301
for return_ty in p.return_types {
301-
let ty = TableDataType::from_pb(return_ty.ty.ok_or_else(|| {
302+
let ty_pb = return_ty.ty.ok_or_else(|| {
302303
Incompatible::new("UDTF.arg_types.ty can not be None".to_string())
303-
})?)?;
304+
})?;
305+
let ty = TableDataType::from_pb(ty_pb)?;
304306

305307
return_types.push((return_ty.name, (&ty).into()));
306308
}

src/meta/protos/proto/udf.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ message UDTF {
7878
uint64 ver = 100;
7979
uint64 min_reader_ver = 101;
8080

81+
// arg name with data type
8182
repeated UDTFArg arg_types = 1;
83+
// return column name with data type
8284
repeated UDTFArg return_types = 2;
8385
string sql = 3;
8486
}

0 commit comments

Comments
 (0)