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

Cannot use subquery with QueryBuilder because SubQuery.close() is package private? #647

Closed
tonyclyde opened this issue Dec 26, 2019 · 4 comments

Comments

@tonyclyde
Copy link

Am I missing something or does this method need to be made public for QueryBuilder subqueries to be usable outside of the org.influxdb.querybuilder package? Trying to imitate the examples here: https://github.com/influxdata/influxdb-java/blob/master/src/test/java/org/influxdb/querybuilder/SelectionSubQueryImplTest.java#L65 but cant without access to that method.

@majst01
Copy link
Collaborator

majst01 commented Dec 27, 2019

Can you show your actual code ?

@tonyclyde
Copy link
Author

Yeah, Im using scala but get the same behavior when i change to java. Im using: org.influxdb:influxdb-java:2.17 and my code is something like this:

Query query = select()
            .sum("column_1").as("count")
            .fromSubQuery("database", "table")
            .where(eq("column_2", "value"))
            .groupBy("column_3")
            .close()
            .where(gt("count", 0));

When i put my class in the org.influxdb.querybuilder package it compiles fine, but when its in my own java package, I get:

error: close() is not public in SubQuery; cannot be accessed from outside package
            .close()
            ^
where T is a type-variable:
  T extends WithSubquery declared in class SubQuery

Or from my scala script:

method close in class SubQuery cannot be accessed in org.influxdb.querybuilder.SelectSubQueryImpl[org.influxdb.querybuilder.SelectQueryImpl]

This is all java 1.8 and scala 2.12

@majst01
Copy link
Collaborator

majst01 commented Jan 2, 2020

seems legit, so you mind raising a PR with a test ?

@kaszperro
Copy link

any progess on this?

ooktay pushed a commit to ooktay/influxdb-java that referenced this issue May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants