diff --git a/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgDeclaration.java b/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgDeclaration.java index c8f8d332b2..f7bb3f0395 100644 --- a/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgDeclaration.java +++ b/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgDeclaration.java @@ -217,6 +217,9 @@ public ObjectNode serialize( ObjectMapper mapper ) { for ( Parameter p : posParams ) { posArr.add( p.serialize( mapper ) ); } + if ( !posArr.isEmpty() && canUnpackValues() ) { + ((ObjectNode) posArr.get( 0 )).put( "canUnpackValues", true); + } node.set( "posParams", posArr ); ArrayNode kwArr = mapper.createArrayNode(); @@ -308,6 +311,7 @@ public ObjectNode serialize( ObjectMapper mapper ) { node.put( "requiresAlias", requiresAlias ); if ( !isPositional() ) { node.set( "defaultValue", defaultValue.serializeWrapped( null, List.of(), mapper ) ); + node.put( "defaultPolyAlg", defaultValue.toPolyAlg( null, List.of() ) ); } node.put( "isEnum", type.isEnum() ); diff --git a/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgUtils.java b/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgUtils.java index 7523667aa2..201a21731f 100644 --- a/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgUtils.java +++ b/core/src/main/java/org/polypheny/db/algebra/polyalg/PolyAlgUtils.java @@ -115,12 +115,16 @@ private static boolean isCastWithSameName( String exp, String alias ) { /** * Joins the values for a multivalued attribute into a single string. * If values contains more than one element, the returned string is surrounded with brackets to represent a list. + * An empty list is indicated with {@code "[]"}. * * @param values the values to be joined * @param omitBrackets whether the surrounding brackets in the case of multiple values should be omitted * @return a string either representing a list containing all entries of values or a single value if values is of size 1 */ public static String joinMultiValued( List values, boolean omitBrackets ) { + if ( values.isEmpty() ) { + return "[]"; + } String str = String.join( ", ", values ); return (omitBrackets || values.size() <= 1) ? str : "[" + str + "]"; }