Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add offset value in DefaultLimitSpec using groupby query ? #172

Open
bhavukgirdhar opened this issue Sep 21, 2021 · 1 comment
Open

Comments

@bhavukgirdhar
Copy link

No description provided.

@szymeker
Copy link

I know that it may feel a little bit hacky, but while waiting for the next release you can override DefaultLimitSpec in your code.
Just create a package with the same name in.zapr.druid.druidry.limitSpec and class DefaultLimitSpec with type field added.
Something like that:

@Getter
@EqualsAndHashCode
public class DefaultLimitSpec {
    private static final String DEFAULT_LIMIT_SPEC_TYPE = "default";

    private String type;
    private int limit;
    private int offset;
    private List<OrderByColumnSpec> columns;

    public DefaultLimitSpec(int limit, @NonNull List<OrderByColumnSpec> columns) {
        this(limit, 0, columns);
    }

    public DefaultLimitSpec(int limit, int offset, @NonNull List<OrderByColumnSpec> columns) {
        this.type = DEFAULT_LIMIT_SPEC_TYPE;
        this.limit = limit;
        this.offset = offset;
        this.columns = columns;
    }
}

You can replace lombok annotations with base java methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants