Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ jobs:

- name: build and test cadc-tap-server-oracle
run: cd cadc-tap-server-oracle && ../gradlew --info clean build javadoc install

- name: build and test cadc-test-tap
run: cd cadc-test-tap && ../gradlew --info clean build javadoc install

- name: build example-tap
run: cd example-tap && ../gradlew --info clean build


- name: build and test cadc-tap-server-bigquery
run: cd cadc-tap-server-bigquery && ../gradlew --info clean build javadoc checkstyleMain install
3 changes: 3 additions & 0 deletions cadc-tap-server-bigquery/README.md
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.
Copy link
Member

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 in youcat, some are in cadc-tap-server-pg (or other libs), and some are the defaults from cadc-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

33 changes: 33 additions & 0 deletions cadc-tap-server-bigquery/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
plugins {
id "java"
Copy link
Member

Choose a reason for hiding this comment

The 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

  • merge master in if you haven't done that recently
  • plugins: java-library, maven-publish, checkstyle
  • do not use the old maven plugin

The included ../opencadc.gradle configures the maven-publish plugin to do the old install task so usage is the same.

Also, below you can update sourceCompatibility to 11... probably need to by now.

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,)'
}
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;
}
}
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());
}
}
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;
}
}
Loading