You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/07/14 22:15:08 UTC
[L] Change in asterixdb[master]: [WIP] add function_metadata() datasource function
From Ian Maxon <im...@apache.org>:
Ian Maxon has posted comments on this change by Ian Maxon. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430?usp=email )
Change subject: [WIP] add function_metadata() datasource function
......................................................................
Patch Set 1:
(5 comments)
This change is ready for review.
Patchset:
PS1:
a high level question: was an llm used to write some part of this? if so the Generated-by: field needs to be added to the commit and ideally each generated part should be marked with the @AiProvenance annotation
File asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/FunctionMetadataFunction.java:
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430/comment/71a9120d_b97615ba?usp=email :
PS1, Line 41: static final String KIND_BUILTIN = "builtin";
: static final String KIND_UDF = "udf";
there are many other constant strings in this file. treat them like you did these two, or better yet, import them from the class that more or less has control of the thing the name describes.
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430/comment/b45edee6_8fd9e82a?usp=email :
PS1, Line 61: new String[0]
why not records.size()? or better yet just make FunctionMetadataReader accept List<String> instead of passing the array?
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430/comment/da8b95b6_df6ca0a4?usp=email :
PS1, Line 76: static String buildRecord(String name, int arity, String category, boolean isPrivate, String kind, String dataverse,
: List<String> aliases) {
: StringBuilder sb = new StringBuilder();
: sb.append("{\"name\":\"").append(escape(name)).append("\",\"arity\":").append(arity).append(",\"category\":\"")
: .append(escape(category)).append("\",\"private\":").append(isPrivate).append(",\"kind\":\"")
: .append(escape(kind)).append("\",\"dataverse\":");
: if (dataverse == null) {
: sb.append("null");
: } else {
: sb.append('"').append(escape(dataverse)).append('"');
: }
: sb.append(",\"aliases\":[");
: for (int i = 0; i < aliases.size(); i++) {
: if (i > 0) {
: sb.append(',');
: }
: sb.append('"').append(escape(aliases.get(i))).append('"');
: }
: sb.append("]}");
this is very hard to read and fiddly. use jackson to construct the output object instead of concatenating strings
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430/comment/89120b72_15791021?usp=email :
PS1, Line 146: private static String escape(String s) {
: StringBuilder sb = new StringBuilder(s.length());
: for (int i = 0; i < s.length(); i++) {
: char c = s.charAt(i);
: if (c == '"' || c == '\\') {
: sb.append('\\').append(c);
: } else if (c < 0x20) {
: sb.append(String.format("\\u%04x", (int) c));
: } else {
: sb.append(c);
: }
: }
: return sb.toString();
use like JSONUtil.escape or defer this to jackson
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21430?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I58db212ca4876e634e1e28fca37f75f96f387d6d
Gerrit-Change-Number: 21430
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Maxon <im...@apache.org>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-CC: Anon. E. Moose #1000171
Gerrit-CC: Suryaa Charan <su...@gmail.com>
Gerrit-CC: Vivek Gangavarapu <ga...@gmail.com>
Gerrit-Comment-Date: Tue, 14 Jul 2026 22:15:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No