(Context<?> ctx)
| 167 | } |
| 168 | |
| 169 | final void accept0(Context<?> ctx) { |
| 170 | QueryPartCollectionView<Field<?>> mapped = QueryPartCollectionView.wrap((Collection<Field<?>>) fields).map(JSONEntryImpl.jsonCastMapper(ctx)); |
| 171 | |
| 172 | switch (ctx.family()) { |
| 173 | |
| 174 | |
| 175 | case POSTGRES: |
| 176 | case YUGABYTEDB: |
| 177 | if (onNull == JSONOnNull.ABSENT_ON_NULL && !mapped.isEmpty()) { |
| 178 | Row1[] rows = map(fields, f -> row(f), Row1[]::new); |
| 179 | Table<?> t = values(rows).as("t", "a"); |
| 180 | Field<?> a = t.field("a"); |
| 181 | ctx.visit(DSL.field( |
| 182 | select((Field<?>) (getDataType() == JSON ? jsonArrayAgg(a) : jsonbArrayAgg(a))) |
| 183 | .from(t) |
| 184 | .where(a.isNotNull()) |
| 185 | )); |
| 186 | } |
| 187 | else |
| 188 | ctx.visit(getDataType() == JSON ? N_JSON_BUILD_ARRAY : N_JSONB_BUILD_ARRAY).sql('(').visit(mapped).sql(')'); |
| 189 | |
| 190 | break; |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 |
no test coverage detected