gfphoenix78 commented on code in PR #901:
URL: https://github.com/apache/cloudberry/pull/901#discussion_r2123349656


##########
contrib/try_convert/try_convert.c:
##########
@@ -0,0 +1,446 @@
+#include "postgres.h"
+
+#include "catalog/pg_cast.h"
+#include "utils/syscache.h"
+#include "utils/lsyscache.h"
+#include "nodes/nodeFuncs.h"
+// #include "nodes/miscnodes.h"
+
+#include "executor/spi.h"
+
+#include "funcapi.h"
+
+#define USE_PG_TRY_CATCH
+
+PG_MODULE_MAGIC;
+
+PG_FUNCTION_INFO_V1(try_convert);
+
+
+typedef enum ConversionType
+{
+       CONVERSION_TYPE_FUNC,
+       CONVERSION_TYPE_RELABEL,
+       CONVERSION_TYPE_VIA_IO,
+       CONVERSION_TYPE_ARRAY,  
+    CONVERSION_TYPE_NONE       
+} ConversionType;
+
+
+ConversionType find_conversion_way(Oid targetTypeId, Oid sourceTypeId, Oid 
*funcId);
+ConversionType find_typmod_conversion_function(Oid typeId, Oid *funcId);
+Datum convert_from_function(Datum value, int32 typmod, Oid funcId, bool 
*is_failed);
+Datum convert_via_io(Datum value, Oid sourceTypeId, Oid targetTypeId, int32 
targetTypMod, bool *is_failed);
+int32 get_call_expr_argtypmod(Node *expr, int argnum);
+Oid get_fn_expr_argtypmod(FmgrInfo *flinfo, int argnum);
+Datum convert(Datum value, ConversionType conversion_type, Oid funcId, Oid 
sourceTypeId, Oid targetTypeId, int32 targetTypMod, bool *is_failed);
+Datum convert_type_typmod(Datum value, int32 sourceTypMod, Oid targetTypeId, 
int32 targetTypMod, bool *is_failed);

Review Comment:
   Internal functions should be static functions as possible. The single line 
should be avoid too long.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to