Repository: kestra-io/kestra
File: jdbc/src/main/java/io/kestra/jdbc/repository/AbstractJdbcRepository.java (Java)

Code before:
            case "enabled" -> false;
            default -> null;
        };
        if (isDisabled == null) {
            return DSL.noCondition();
        }
        return switch (operation) {
            case EQUALS -> field("value",JSONB.class).contains(JSONB.valueOf("{\"disabled\": " + isDisabled + "}"));
            case NOT_EQUALS -> field("value",JSONB.class).contains(JSONB.valueOf("{\"disabled\": " + !isDisabled + "}"));
            default -> throw new InvalidQueryFiltersException("Unsupported operation for Trigger State: " + operation);
        };
    }


    protected Field<Date> formatDateField(String dateField, DateUtils.GroupType groupType) {
        throw new UnsupportedOperationException("formatDateField() not implemented");
    }

    protected <F extends Enum<F>> List<Field<Date>> generateDateFields(
        DataFilter<F, ? extends ColumnDescriptor<F>> descriptors,
        Map<F, String> fieldsMapping,
        ZonedDateTime startDate,
        ZonedDateTime endDate,
        Set<F> dateFields,
        @Nullable DateUtils.GroupType groupType
    ) {
        return descriptors.getColumns().entrySet().stream()
            .filter(entry -> entry.getValue().getAgg() == null && dateFields.contains(entry.getValue().getField()))
            .map(entry -> {
                Duration duration = Duration.between(startDate, endDate == null ? ZonedDateTime.now() : endDate);
                DateUtils.GroupType effectiveGroupType = groupType != null ? groupType : DateUtils.groupByType(duration);
                return formatDateField(fieldsMapping.get(entry.getValue().getField()), effectiveGroupType).as(entry.getKey());
            })
            .toList();

    }
}


Review comment (suggestion):
This would effectively parser the JSON of the trigger which we tend to avoid.
If you need to select on the `disbaled` field, you need to add a STORED column for it, this is how we always do

Code after:
        }
        FlowScope scope = flowScopes.getFirst();

        String systemNamespace = this.getSystemFlowNamespace();
        return switch (operation){
            case EQUALS -> FlowScope.USER.equals(scope) ? field("namespace").ne(systemNamespace) : field("namespace").eq(systemNamespace);
            case NOT_EQUALS -> FlowScope.USER.equals(scope) ? field("namespace").eq(systemNamespace) : field("namespace").ne(systemNamespace);
            default -> throw new InvalidQueryFiltersException("Unsupported operation for SCOPE: " + operation);
        };
    }

    private Condition applyTriggerStateCondition(Object value, QueryFilter.Op operation) {
        String triggerState =  value.toString();
        Boolean isDisabled = switch (triggerState) {
            case "disabled" -> true;
            case "enabled" -> false;
            default -> null;
        };
        if (isDisabled == null) {
            return DSL.noCondition();
        }
        return switch (operation) {
            case EQUALS -> field("disabled").eq(isDisabled);
            case NOT_EQUALS -> field("disabled").ne(isDisabled);
            default -> throw new InvalidQueryFiltersException("Unsupported operation for Trigger State: " + operation);
        };
    }

    protected Field<Date> formatDateField(String dateField, DateUtils.GroupType groupType) {
        throw new UnsupportedOperationException("formatDateField() not implemented");
    }

    protected <F extends Enum<F>> List<Field<Date>> generateDateFields(
        DataFilter<F, ? extends ColumnDescriptor<F>> descriptors,
        Map<F, String> fieldsMapping,
        ZonedDateTime startDate,
        ZonedDateTime endDate,
        Set<F> dateFields,
        @Nullable DateUtils.GroupType groupType
    ) {
        return descriptors.getColumns().entrySet().stream()
            .filter(entry -> entry.getValue().getAgg() == null && dateFields.contains(entry.getValue().getField()))
            .map(entry -> {
                Duration duration = Duration.between(startDate, endDate == null ? ZonedDateTime.now() : endDate);
                DateUtils.GroupType effectiveGroupType = groupType != null ? groupType : DateUtils.groupByType(duration);
                return formatDateField(fieldsMapping.get(entry.getValue().getField()), effectiveGroupType).as(entry.getKey());
            })
            .toList();

    }
}