Skip to content

Commit 179c489

Browse files
committed
fix: udf name and pg_is_table_visible
1 parent ad180eb commit 179c489

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

datafusion-postgres/src/pg_catalog.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,7 @@ pub fn create_version_udf() -> ScalarUDF {
17661766
let func = move |_args: &[ColumnarValue]| {
17671767
// Create a UTF8 array with version information
17681768
let mut builder = StringBuilder::new();
1769+
// TODO: improve version string generation
17691770
builder
17701771
.append_value("DataFusion PostgreSQL 48.0.0 on x86_64-pc-linux-gnu, compiled by Rust");
17711772
let array: ArrayRef = Arc::new(builder.finish());
@@ -1799,7 +1800,7 @@ pub fn create_pg_get_userbyid_udf() -> ScalarUDF {
17991800

18001801
// Wrap the implementation in a scalar function
18011802
create_udf(
1802-
"pg_get_userbyid",
1803+
"pg_catalog.pg_get_userbyid",
18031804
vec![DataType::Int32],
18041805
DataType::Utf8,
18051806
Volatility::Stable,
@@ -1811,19 +1812,22 @@ pub fn create_pg_table_is_visible() -> ScalarUDF {
18111812
// Define the function implementation
18121813
let func = move |args: &[ColumnarValue]| {
18131814
let args = ColumnarValue::values_to_arrays(args)?;
1814-
let _input = &args[0]; // Table OID
1815+
let input = &args[0]; // Table OID
18151816

18161817
// Always return true
18171818
let mut builder = BooleanBuilder::new();
1818-
builder.append_value(true);
1819+
for _ in 0..input.len() {
1820+
builder.append_value(true);
1821+
}
1822+
18191823
let array: ArrayRef = Arc::new(builder.finish());
18201824

18211825
Ok(ColumnarValue::Array(array))
18221826
};
18231827

18241828
// Wrap the implementation in a scalar function
18251829
create_udf(
1826-
"pg_table_is_visible",
1830+
"pg_catalog.pg_table_is_visible",
18271831
vec![DataType::Int32],
18281832
DataType::Boolean,
18291833
Volatility::Stable,

0 commit comments

Comments
 (0)