Skip to content

Commit ffb0fdf

Browse files
authored
chore: move Google JDBC driver code (#4050)
1 parent 719f8fd commit ffb0fdf

File tree

108 files changed

+39784
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+39784
-0
lines changed

google-cloud-bigquery-jdbc/pom.xml

Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright 2025 Google LLC
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0"
18+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
<modelVersion>4.0.0</modelVersion>
21+
<groupId>com.google.cloud</groupId>
22+
<artifactId>google-cloud-bigquery-jdbc</artifactId>
23+
<version>0.1.0</version>
24+
<packaging>jar</packaging>
25+
<name>BigQuery JDBC</name>
26+
<url>https://github.com/googleapis/java-bigquery-jdbc</url>
27+
<description>JDBC for BigQuery</description>
28+
29+
<properties>
30+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
31+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
32+
<github.global.server>github</github.global.server>
33+
<site.installationModule>google-cloud-bigquery-jdbc
34+
</site.installationModule>
35+
</properties>
36+
37+
<build>
38+
<resources>
39+
<resource>
40+
<directory>src/main/resources</directory>
41+
<filtering>true</filtering>
42+
</resource>
43+
</resources>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-surefire-plugin</artifactId>
48+
<version>3.5.2</version>
49+
<configuration>
50+
<skip>${skipSurefire}</skip>
51+
</configuration>
52+
</plugin>
53+
<plugin>
54+
<groupId>org.jacoco</groupId>
55+
<artifactId>jacoco-maven-plugin</artifactId>
56+
<version>0.8.13</version>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
61+
<parent>
62+
<groupId>com.google.cloud</groupId>
63+
<artifactId>google-cloud-bigquery-jdbc-parent</artifactId>
64+
<version>0.1.0</version>
65+
</parent>
66+
<dependencies>
67+
<dependency>
68+
<groupId>com.google.cloud</groupId>
69+
<artifactId>google-cloud-bigquery</artifactId>
70+
</dependency>
71+
<dependency>
72+
<groupId>com.google.cloud</groupId>
73+
<artifactId>google-cloud-bigquerystorage</artifactId>
74+
</dependency>
75+
<dependency>
76+
<groupId>com.google.api</groupId>
77+
<artifactId>api-common</artifactId>
78+
</dependency>
79+
<dependency>
80+
<groupId>org.apache.arrow</groupId>
81+
<artifactId>arrow-vector</artifactId>
82+
</dependency>
83+
<dependency>
84+
<groupId>com.google.guava</groupId>
85+
<artifactId>guava</artifactId>
86+
</dependency>
87+
<dependency>
88+
<groupId>com.google.cloud</groupId>
89+
<artifactId>google-cloud-core</artifactId>
90+
</dependency>
91+
<dependency>
92+
<groupId>com.google.api</groupId>
93+
<artifactId>gax</artifactId>
94+
</dependency>
95+
<dependency>
96+
<groupId>com.google.auth</groupId>
97+
<artifactId>google-auth-library-oauth2-http</artifactId>
98+
</dependency>
99+
<dependency>
100+
<groupId>com.google.auth</groupId>
101+
<artifactId>google-auth-library-credentials</artifactId>
102+
</dependency>
103+
104+
<!-- Dependencies for Arrow RS -->
105+
<dependency>
106+
<groupId>org.apache.arrow</groupId>
107+
<artifactId>arrow-memory-core</artifactId>
108+
</dependency>
109+
<dependency>
110+
<groupId>org.apache.arrow</groupId>
111+
<artifactId>arrow-memory-netty</artifactId>
112+
</dependency>
113+
<dependency>
114+
<groupId>com.google.protobuf</groupId>
115+
<artifactId>protobuf-java</artifactId>
116+
</dependency>
117+
<dependency>
118+
<groupId>com.google.api.grpc</groupId>
119+
<artifactId>proto-google-cloud-bigquerystorage-v1</artifactId>
120+
</dependency>
121+
<dependency>
122+
<groupId>com.google.code.gson</groupId>
123+
<artifactId>gson</artifactId>
124+
</dependency>
125+
<dependency>
126+
<groupId>com.google.code.findbugs</groupId>
127+
<artifactId>jsr305</artifactId>
128+
</dependency>
129+
<dependency>
130+
<groupId>org.apache.httpcomponents.core5</groupId>
131+
<artifactId>httpcore5</artifactId>
132+
</dependency>
133+
<dependency>
134+
<groupId>org.apache.httpcomponents.client5</groupId>
135+
<artifactId>httpclient5</artifactId>
136+
</dependency>
137+
<dependency>
138+
<groupId>com.google.http-client</groupId>
139+
<artifactId>google-http-client</artifactId>
140+
</dependency>
141+
<dependency>
142+
<groupId>com.google.http-client</groupId>
143+
<artifactId>google-http-client-apache-v5</artifactId>
144+
<exclusions> <!-- Exclusions are here for removing EOL vulnerability -->
145+
<exclusion>
146+
<groupId>org.apache.httpcomponents</groupId>
147+
<artifactId>httpcore</artifactId>
148+
</exclusion>
149+
<exclusion>
150+
<groupId>org.apache.httpcomponents</groupId>
151+
<artifactId>httpclient</artifactId>
152+
</exclusion>
153+
</exclusions>
154+
</dependency>
155+
<dependency>
156+
<groupId>com.google.cloud</groupId>
157+
<artifactId>google-cloud-core-http</artifactId>
158+
</dependency>
159+
<dependency>
160+
<groupId>com.google.api</groupId>
161+
<artifactId>gax-grpc</artifactId>
162+
</dependency>
163+
<dependency>
164+
<groupId>io.grpc</groupId>
165+
<artifactId>grpc-api</artifactId>
166+
</dependency>
167+
<dependency>
168+
<groupId>io.grpc</groupId>
169+
<artifactId>grpc-netty-shaded</artifactId>
170+
</dependency>
171+
<dependency>
172+
<groupId>io.grpc</groupId>
173+
<artifactId>grpc-core</artifactId>
174+
</dependency>
175+
<!-- Test Dependencies -->
176+
<dependency>
177+
<groupId>com.google.truth</groupId>
178+
<artifactId>truth</artifactId>
179+
<version>1.1.3</version>
180+
<scope>test</scope>
181+
</dependency>
182+
<dependency>
183+
<groupId>junit</groupId>
184+
<artifactId>junit</artifactId>
185+
<version>4.13.2</version>
186+
<scope>test</scope>
187+
</dependency>
188+
<dependency>
189+
<groupId>org.mockito</groupId>
190+
<artifactId>mockito-core</artifactId>
191+
<version>4.11.0</version>
192+
<scope>test</scope>
193+
</dependency>
194+
</dependencies>
195+
196+
<profiles>
197+
<profile>
198+
<id>java17</id>
199+
<activation>
200+
<jdk>[17,)</jdk>
201+
<property>
202+
<!--
203+
In Java 8 unit tests where we run tests in Java 8 after building
204+
bytecode on Java 17, we don't want to add the argLine
205+
-->
206+
<name>!jvm</name>
207+
</property>
208+
</activation>
209+
<build>
210+
<plugins>
211+
<plugin>
212+
<groupId>org.apache.maven.plugins</groupId>
213+
<artifactId>maven-surefire-plugin</artifactId>
214+
<configuration>
215+
<argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
216+
</configuration>
217+
</plugin>
218+
</plugins>
219+
</build>
220+
</profile>
221+
222+
<!-- Profile used to build JAR with all dependencies for the release. -->
223+
<profile>
224+
<id>release-all-dependencies-shaded</id>
225+
<build>
226+
<plugins>
227+
<plugin>
228+
<groupId>org.apache.maven.plugins</groupId>
229+
<artifactId>maven-shade-plugin</artifactId>
230+
<version>3.5.2</version> <!-- Use the latest version -->
231+
<executions>
232+
<execution>
233+
<configuration>
234+
<relocations>
235+
<relocation>
236+
<pattern>com</pattern>
237+
<shadedPattern>shaded.bqjdbc.com</shadedPattern>
238+
<excludes>
239+
<exclude>com.google.cloud.bigquery.jdbc.*</exclude>
240+
</excludes>
241+
</relocation>
242+
<relocation>
243+
<pattern>org</pattern>
244+
<shadedPattern>shaded.bqjdbc.org</shadedPattern>
245+
<excludes>
246+
<exclude>org.conscrypt.*</exclude>
247+
</excludes>
248+
</relocation>
249+
<relocation>
250+
<pattern>io</pattern>
251+
<shadedPattern>shaded.bqjdbc.io</shadedPattern>
252+
</relocation>
253+
</relocations>
254+
</configuration>
255+
</execution>
256+
</executions>
257+
</plugin>
258+
</plugins>
259+
</build>
260+
</profile>
261+
262+
<profile>
263+
<id>release-all-dependencies</id>
264+
<build>
265+
<plugins>
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-shade-plugin</artifactId>
269+
<version>3.5.2</version> <!-- Use the latest version -->
270+
<executions>
271+
<execution>
272+
<phase>package</phase>
273+
<goals>
274+
<goal>shade</goal>
275+
</goals>
276+
<configuration>
277+
<createDependencyReducedPom>false</createDependencyReducedPom>
278+
<archive>
279+
<manifestEntries>
280+
<Add-Opens>java.base/java.nio=ALL-UNNAMED</Add-Opens>
281+
</manifestEntries>
282+
</archive>
283+
<transformers>
284+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
285+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
286+
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
287+
<resource>META-INF/io.netty.versions.properties</resource>
288+
</transformer>
289+
</transformers>
290+
<filters>
291+
<filter>
292+
<artifact>*:*</artifact>
293+
<excludes>
294+
<exclude>META-INF/LICENSE*</exclude>
295+
<exclude>META-INF/NOTICE*</exclude>
296+
<exclude>META-INF/DEPENDENCIES</exclude>
297+
<exclude>META-INF/proguard/*.pro</exclude>
298+
<exclude>META-INF/maven/**</exclude>
299+
<exclude>META-INF/*.MF</exclude>
300+
<exclude>META-INF/*.SF</exclude>
301+
<exclude>META-INF/*.DSA</exclude>
302+
<exclude>META-INF/*.RSA</exclude>
303+
<exclude>arrow-git.properties</exclude>
304+
</excludes>
305+
</filter>
306+
</filters>
307+
</configuration>
308+
</execution>
309+
</executions>
310+
</plugin>
311+
</plugins>
312+
</build>
313+
</profile>
314+
315+
<!-- Profile used inside docker -->
316+
<profile>
317+
<id>docker</id>
318+
<activation>
319+
<property>
320+
<name>env.JDBC_DOCKER_ENV</name>
321+
</property>
322+
</activation>
323+
<build>
324+
<!-- Ensure it doesn't conflict with local build directories -->
325+
<directory>/mvn/test-target</directory>
326+
</build>
327+
</profile>
328+
</profiles>
329+
</project>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.bigquery.exception;
18+
19+
import java.sql.SQLException;
20+
21+
/**
22+
* Exception for errors that occur when the driver cannot convert a value from one type to another.
23+
*/
24+
public class BigQueryConversionException extends SQLException {
25+
26+
public BigQueryConversionException(String message, Throwable cause) {
27+
super(message, cause);
28+
}
29+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.bigquery.exception;
18+
19+
import com.google.api.core.InternalApi;
20+
21+
/**
22+
* Thrown to indicate that the coercion was attempted but couldn't be performed successfully because
23+
* of some error.
24+
*/
25+
@InternalApi
26+
public class BigQueryJdbcCoercionException extends RuntimeException {
27+
28+
/**
29+
* Construct a new exception with the specified cause.
30+
*
31+
* @param cause the actual cause which was thrown while performing the coercion.
32+
*/
33+
public BigQueryJdbcCoercionException(Exception cause) {
34+
super("Coercion error", cause);
35+
}
36+
}

0 commit comments

Comments
 (0)