-
Notifications
You must be signed in to change notification settings - Fork 18
BigQuery TAP support #172
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
Open
dspeck1
wants to merge
6
commits into
opencadc:main
Choose a base branch
from
Burwood:tap-server-bigquery
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
BigQuery TAP support #172
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e182f82
Add tap support for BigQuery as backend.
dspeck1 8f2b5af
Add tap server bigquery build step to CI.
dspeck1 04b5edc
Remove jcenter repository and publishing setup.
dspeck1 cbf5a90
change ordering to hopefully avoid git conflict
dspeck1 18deb91
FIx oracle build step
dspeck1 ee51626
Merge branch 'main' into tap-server-bigquery
dspeck1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# cadc-tap-server-bigquery 1.0.0 | ||
|
||
Offers BigQuery support to handle datatype conversions in ADQL. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
plugins { | ||
id "java" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have updated builds (../opencadc.gradle) to work with gradle 6-8 so
The included ../opencadc.gradle configures the maven-publish plugin to do the old Also, below you can update sourceCompatibility to |
||
id "maven" | ||
id 'maven-publish' | ||
id 'checkstyle' | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
apply from: '../opencadc.gradle' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
group = 'org.opencadc' | ||
|
||
version = '1.0.5' | ||
|
||
description = 'OpenCADC TAP-1.1 tap server plugin (BigQuery)' | ||
def git_url = 'https://github.com/opencadc/tap' | ||
|
||
dependencies { | ||
implementation 'org.opencadc:cadc-tap-schema:[1.1.22,)' | ||
implementation 'org.opencadc:cadc-tap-server:[1.1.7,)' | ||
implementation 'org.opencadc:cadc-adql:[1.1.10,)' | ||
implementation 'org.opencadc:cadc-jsqlparser-compat:[0.6.4,)' | ||
|
||
testImplementation 'junit:junit:[4.0,5.0)' | ||
testImplementation 'org.opencadc:cadc-util:[1.6,)' | ||
testImplementation 'xerces:xercesImpl:[2.0,)' | ||
} |
92 changes: 92 additions & 0 deletions
92
...tap-server-bigquery/src/main/java/ca/nrc/cadc/tap/expression/BqColumnAliasSelectItem.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
/* | ||
************************************************************************ | ||
******************* CANADIAN ASTRONOMY DATA CENTRE ******************* | ||
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** | ||
* | ||
* (c) 2019. (c) 2019. | ||
* Government of Canada Gouvernement du Canada | ||
* National Research Council Conseil national de recherches | ||
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 | ||
* All rights reserved Tous droits réservés | ||
* | ||
* NRC disclaims any warranties, Le CNRC dénie toute garantie | ||
* expressed, implied, or énoncée, implicite ou légale, | ||
* statutory, of any kind with de quelque nature que ce | ||
* respect to the software, soit, concernant le logiciel, | ||
* including without limitation y compris sans restriction | ||
* any warranty of merchantability toute garantie de valeur | ||
* or fitness for a particular marchande ou de pertinence | ||
* purpose. NRC shall not be pour un usage particulier. | ||
* liable in any event for any Le CNRC ne pourra en aucun cas | ||
* damages, whether direct or être tenu responsable de tout | ||
* indirect, special or general, dommage, direct ou indirect, | ||
* consequential or incidental, particulier ou général, | ||
* arising from the use of the accessoire ou fortuit, résultant | ||
* software. Neither the name de l'utilisation du logiciel. Ni | ||
* of the National Research le nom du Conseil National de | ||
* Council of Canada nor the Recherches du Canada ni les noms | ||
* names of its contributors may de ses participants ne peuvent | ||
* be used to endorse or promote être utilisés pour approuver ou | ||
* products derived from this promouvoir les produits dérivés | ||
* software without specific prior de ce logiciel sans autorisation | ||
* written permission. préalable et particulière | ||
* par écrit. | ||
* | ||
* This file is part of the Ce fichier fait partie du projet | ||
* OpenCADC project. OpenCADC. | ||
* | ||
* OpenCADC is free software: OpenCADC est un logiciel libre ; | ||
* you can redistribute it and/or vous pouvez le redistribuer ou le | ||
* modify it under the terms of modifier suivant les termes de | ||
* the GNU Affero General Public la “GNU Affero General Public | ||
* License as published by the License” telle que publiée | ||
* Free Software Foundation, par la Free Software Foundation | ||
* either version 3 of the : soit la version 3 de cette | ||
* License, or (at your option) licence, soit (à votre gré) | ||
* any later version. toute version ultérieure. | ||
* | ||
* OpenCADC is distributed in the OpenCADC est distribué | ||
* hope that it will be useful, dans l’espoir qu’il vous | ||
* but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE | ||
* without even the implied GARANTIE : sans même la garantie | ||
* warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ | ||
* or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF | ||
* PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence | ||
* General Public License for Générale Publique GNU Affero | ||
* more details. pour plus de détails. | ||
* | ||
* You should have received Vous devriez avoir reçu une | ||
* a copy of the GNU Affero copie de la Licence Générale | ||
* General Public License along Publique GNU Affero avec | ||
* with OpenCADC. If not, see OpenCADC ; si ce n’est | ||
* <http://www.gnu.org/licenses/>. pas le cas, consultez : | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* | ||
************************************************************************ | ||
*/ | ||
|
||
package ca.nrc.cadc.tap.expression; | ||
|
||
import net.sf.jsqlparser.statement.select.SelectExpressionItem; | ||
import net.sf.jsqlparser.statement.select.SelectItemVisitor; | ||
|
||
public class BqColumnAliasSelectItem extends SelectExpressionItem { | ||
public BqColumnAliasSelectItem(SelectExpressionItem selectExpressionItem) { | ||
super(); | ||
setExpression(selectExpressionItem.getExpression()); | ||
setAlias(selectExpressionItem.getAlias()); | ||
} | ||
|
||
@Override | ||
public void accept(SelectItemVisitor selectItemVisitor) { | ||
selectItemVisitor.visit(this); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
String alias = getAlias(); | ||
return (alias == null) ? getExpression() + "" : alias; | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
cadc-tap-server-bigquery/src/main/java/ca/nrc/cadc/tap/expression/BqExpressionDeParser.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
|
||
/* | ||
************************************************************************ | ||
******************* CANADIAN ASTRONOMY DATA CENTRE ******************* | ||
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** | ||
* | ||
* (c) 2018. (c) 2018. | ||
* Government of Canada Gouvernement du Canada | ||
* National Research Council Conseil national de recherches | ||
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 | ||
* All rights reserved Tous droits réservés | ||
* | ||
* NRC disclaims any warranties, Le CNRC dénie toute garantie | ||
* expressed, implied, or énoncée, implicite ou légale, | ||
* statutory, of any kind with de quelque nature que ce | ||
* respect to the software, soit, concernant le logiciel, | ||
* including without limitation y compris sans restriction | ||
* any warranty of merchantability toute garantie de valeur | ||
* or fitness for a particular marchande ou de pertinence | ||
* purpose. NRC shall not be pour un usage particulier. | ||
* liable in any event for any Le CNRC ne pourra en aucun cas | ||
* damages, whether direct or être tenu responsable de tout | ||
* indirect, special or general, dommage, direct ou indirect, | ||
* consequential or incidental, particulier ou général, | ||
* arising from the use of the accessoire ou fortuit, résultant | ||
* software. Neither the name de l'utilisation du logiciel. Ni | ||
* of the National Research le nom du Conseil National de | ||
* Council of Canada nor the Recherches du Canada ni les noms | ||
* names of its contributors may de ses participants ne peuvent | ||
* be used to endorse or promote être utilisés pour approuver ou | ||
* products derived from this promouvoir les produits dérivés | ||
* software without specific prior de ce logiciel sans autorisation | ||
* written permission. préalable et particulière | ||
* par écrit. | ||
* | ||
* This file is part of the Ce fichier fait partie du projet | ||
* OpenCADC project. OpenCADC. | ||
* | ||
* OpenCADC is free software: OpenCADC est un logiciel libre ; | ||
* you can redistribute it and/or vous pouvez le redistribuer ou le | ||
* modify it under the terms of modifier suivant les termes de | ||
* the GNU Affero General Public la “GNU Affero General Public | ||
* License as published by the License” telle que publiée | ||
* Free Software Foundation, par la Free Software Foundation | ||
* either version 3 of the : soit la version 3 de cette | ||
* License, or (at your option) licence, soit (à votre gré) | ||
* any later version. toute version ultérieure. | ||
* | ||
* OpenCADC is distributed in the OpenCADC est distribué | ||
* hope that it will be useful, dans l’espoir qu’il vous | ||
* but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE | ||
* without even the implied GARANTIE : sans même la garantie | ||
* warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ | ||
* or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF | ||
* PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence | ||
* General Public License for Générale Publique GNU Affero | ||
* more details. pour plus de détails. | ||
* | ||
* You should have received Vous devriez avoir reçu une | ||
* a copy of the GNU Affero copie de la Licence Générale | ||
* General Public License along Publique GNU Affero avec | ||
* with OpenCADC. If not, see OpenCADC ; si ce n’est | ||
* <http://www.gnu.org/licenses/>. pas le cas, consultez : | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* | ||
************************************************************************ | ||
*/ | ||
|
||
package ca.nrc.cadc.tap.expression; | ||
|
||
import ca.nrc.cadc.tap.parser.BaseExpressionDeParser; | ||
import net.sf.jsqlparser.statement.select.SelectVisitor; | ||
|
||
public class BqExpressionDeParser extends BaseExpressionDeParser { | ||
public BqExpressionDeParser(SelectVisitor selectVisitor, StringBuffer buffer) { | ||
super(selectVisitor, buffer); | ||
} | ||
|
||
void visit(BqKeywordExpression expression) { | ||
buffer.append(expression.toString()); | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
cadc-tap-server-bigquery/src/main/java/ca/nrc/cadc/tap/expression/BqKeywordExpression.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
|
||
/* | ||
************************************************************************ | ||
******************* CANADIAN ASTRONOMY DATA CENTRE ******************* | ||
************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** | ||
* | ||
* (c) 2018. (c) 2018. | ||
* Government of Canada Gouvernement du Canada | ||
* National Research Council Conseil national de recherches | ||
* Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 | ||
* All rights reserved Tous droits réservés | ||
* | ||
* NRC disclaims any warranties, Le CNRC dénie toute garantie | ||
* expressed, implied, or énoncée, implicite ou légale, | ||
* statutory, of any kind with de quelque nature que ce | ||
* respect to the software, soit, concernant le logiciel, | ||
* including without limitation y compris sans restriction | ||
* any warranty of merchantability toute garantie de valeur | ||
* or fitness for a particular marchande ou de pertinence | ||
* purpose. NRC shall not be pour un usage particulier. | ||
* liable in any event for any Le CNRC ne pourra en aucun cas | ||
* damages, whether direct or être tenu responsable de tout | ||
* indirect, special or general, dommage, direct ou indirect, | ||
* consequential or incidental, particulier ou général, | ||
* arising from the use of the accessoire ou fortuit, résultant | ||
* software. Neither the name de l'utilisation du logiciel. Ni | ||
* of the National Research le nom du Conseil National de | ||
* Council of Canada nor the Recherches du Canada ni les noms | ||
* names of its contributors may de ses participants ne peuvent | ||
* be used to endorse or promote être utilisés pour approuver ou | ||
* products derived from this promouvoir les produits dérivés | ||
* software without specific prior de ce logiciel sans autorisation | ||
* written permission. préalable et particulière | ||
* par écrit. | ||
* | ||
* This file is part of the Ce fichier fait partie du projet | ||
* OpenCADC project. OpenCADC. | ||
* | ||
* OpenCADC is free software: OpenCADC est un logiciel libre ; | ||
* you can redistribute it and/or vous pouvez le redistribuer ou le | ||
* modify it under the terms of modifier suivant les termes de | ||
* the GNU Affero General Public la “GNU Affero General Public | ||
* License as published by the License” telle que publiée | ||
* Free Software Foundation, par la Free Software Foundation | ||
* either version 3 of the : soit la version 3 de cette | ||
* License, or (at your option) licence, soit (à votre gré) | ||
* any later version. toute version ultérieure. | ||
* | ||
* OpenCADC is distributed in the OpenCADC est distribué | ||
* hope that it will be useful, dans l’espoir qu’il vous | ||
* but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE | ||
* without even the implied GARANTIE : sans même la garantie | ||
* warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ | ||
* or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF | ||
* PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence | ||
* General Public License for Générale Publique GNU Affero | ||
* more details. pour plus de détails. | ||
* | ||
* You should have received Vous devriez avoir reçu une | ||
* a copy of the GNU Affero copie de la Licence Générale | ||
* General Public License along Publique GNU Affero avec | ||
* with OpenCADC. If not, see OpenCADC ; si ce n’est | ||
* <http://www.gnu.org/licenses/>. pas le cas, consultez : | ||
* <http://www.gnu.org/licenses/>. | ||
* | ||
* | ||
************************************************************************ | ||
*/ | ||
|
||
package ca.nrc.cadc.tap.expression; | ||
|
||
import net.sf.jsqlparser.expression.Expression; | ||
import net.sf.jsqlparser.expression.ExpressionVisitor; | ||
|
||
|
||
public class BqKeywordExpression implements Expression { | ||
|
||
private final String keyword; | ||
|
||
public BqKeywordExpression(String keyword) { | ||
this.keyword = keyword; | ||
} | ||
|
||
@Override | ||
public void accept(ExpressionVisitor expressionVisitor) { | ||
if (expressionVisitor instanceof BqExpressionDeParser) { | ||
((BqExpressionDeParser) expressionVisitor).visit(this); | ||
} | ||
} | ||
|
||
/** | ||
* Returns a string representation of the object. In general, the | ||
* {@code toString} method returns a string that | ||
* "textually represents" this object. The result should | ||
* be a concise but informative representation that is easy for a | ||
* person to read. | ||
* It is recommended that all subclasses override this method. | ||
* | ||
* <p>The {@code toString} method for class {@code Object} | ||
* returns a string consisting of the name of the class of which the | ||
* object is an instance, the at-sign character `{@code @}', and | ||
* the unsigned hexadecimal representation of the hash code of the | ||
* object. In other words, this method returns a string equal to the | ||
* value of: | ||
* <blockquote> | ||
* <pre> | ||
* getClass().getName() + '@' + Integer.toHexString(hashCode()) | ||
* </pre></blockquote> | ||
* | ||
* @return a string representation of the object. | ||
*/ | ||
@Override | ||
public String toString() { | ||
return keyword; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some details here to help a developer that wants to build a service using the library and a BigQuery backend?
What JDBC driver do they need to install and configure? (preferrably: class name and maven dependency info to add as a runtime dependency)
Do they put the tap_schema tables and content into BigQuery or a side db? (cadc-tap-server does not currently support them being in separate DBs but we are working on that)
Is it expected to support the optional TAP UPLOAD feature? without a custom
ca.nrc.cadc.tap.db.DatabaseDataType
it seems like that won't work (at least for all data types)It looks like this is the ADQL -> {big query dialect} conversion. Even for that, I would provide a single class that encapsulates all of that.
As an example, the
youcat
module in this repo is a fully functioning TAP service for PostgreSQL. In the src/main/resources you will see the config file for various plugins needed to make that work and some of those are inyoucat
, some are incadc-tap-server-pg
(or other libs), and some are the defaults fromcadc-tap-server
. Admittedly, those might not have the optimal organization as some things in youcat could possibly be moved up to the pg specific lib, but it shows what's needed.Here, it would be good to document the provided implementation classes (like the implementation of TapQuery interface that encapsulates the ADQL query processing) and which DatabaseDataType implementation must/should be used, and any others as outlined in that example PluginFactory.properties