Skip to content

Commit 798ee39

Browse files
committed
Merge branch 'main' into ssl-truststore-handling-2
2 parents 368d019 + 727a245 commit 798ee39

48 files changed

Lines changed: 2083 additions & 274 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Check for NEXT_CHANGELOG.md Changes
2+
3+
on:
4+
pull_request_target:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
check-next-changelog:
13+
runs-on:
14+
group: databricks-protected-runner-group
15+
labels: linux-ubuntu-latest
16+
17+
steps:
18+
- name: Checkout base branch (main)
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.event.pull_request.base.ref }}
22+
fetch-depth: 0
23+
24+
- name: Fetch list of changed files
25+
id: changed-files
26+
run: |
27+
files=$(git diff --name-only HEAD^ HEAD || git diff --name-only origin/main HEAD)
28+
echo "MODIFIED_FILES<<EOF" >> $GITHUB_ENV
29+
echo "$files" >> $GITHUB_ENV
30+
echo "EOF" >> $GITHUB_ENV
31+
32+
- name: Verify NEXT_CHANGELOG.md was modified or PR message contains NO_CHANGELOG=true
33+
id: verify-changelog
34+
run: |
35+
PR_BODY="${{ github.event.pull_request.body }}"
36+
echo "PR body: $PR_BODY"
37+
38+
if ! echo "$MODIFIED_FILES" | grep -q "NEXT_CHANGELOG.md"; then
39+
if echo "$PR_BODY" | grep -q "NO_CHANGELOG=true"; then
40+
echo "NO_CHANGELOG=true found in PR body."
41+
echo "CHANGELOG_NEEDED=false" >> $GITHUB_ENV
42+
exit 0
43+
else
44+
echo "ERROR: NEXT_CHANGELOG.md not modified and NO_CHANGELOG=true not present."
45+
echo "CHANGELOG_NEEDED=true" >> $GITHUB_ENV
46+
exit 1
47+
fi
48+
else
49+
echo "✅ NEXT_CHANGELOG.md was updated."
50+
echo "CHANGELOG_NEEDED=false" >> $GITHUB_ENV
51+
fi
52+
53+
- name: Comment on PR with instructions if needed
54+
if: failure() && env.CHANGELOG_NEEDED == 'true'
55+
uses: actions/github-script@v7
56+
with:
57+
github-token: ${{ secrets.GITHUB_TOKEN }}
58+
script: |
59+
const { owner, repo } = context.repo;
60+
const issue_number = context.issue.number;
61+
62+
// Check if we've already commented
63+
const comments = await github.rest.issues.listComments({
64+
owner,
65+
repo,
66+
issue_number
67+
});
68+
69+
const existingComment = comments.data.find(comment =>
70+
comment.body.includes('<!-- NEXT_CHANGELOG_INSTRUCTIONS -->')
71+
);
72+
73+
if (!existingComment) {
74+
await github.rest.issues.createComment({
75+
owner,
76+
repo,
77+
issue_number,
78+
body: `<!-- NEXT_CHANGELOG_INSTRUCTIONS -->
79+
Please ensure that the \`NEXT_CHANGELOG.md\` file is updated with any relevant changes.
80+
If this is not necessary for your PR, include this in the PR body:
81+
82+
\`\`\`
83+
NO_CHANGELOG=true
84+
\`\`\`
85+
86+
and rerun the workflow.`
87+
});
88+
}
89+
90+
- name: Delete instructions comment on success
91+
if: success() && env.CHANGELOG_NEEDED == 'false'
92+
uses: actions/github-script@v7
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
script: |
96+
const { owner, repo } = context.repo;
97+
const issue_number = context.issue.number;
98+
99+
const comments = await github.rest.issues.listComments({
100+
owner,
101+
repo,
102+
issue_number
103+
});
104+
105+
const existingComments = comments.data.filter(comment =>
106+
comment.body.includes('<!-- NEXT_CHANGELOG_INSTRUCTIONS -->')
107+
);
108+
109+
for (const comment of existingComments) {
110+
await github.rest.issues.deleteComment({
111+
owner,
112+
repo,
113+
comment_id: comment.id
114+
});
115+
}

CONTRIBUTING.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Databricks JDBC Driver development, set up a GitHub account. Then:
6161
```bash
6262
git add -A
6363

64-
git commit -m "Commit Message"
64+
git commit -s -m "Commit Message"
6565
```
6666

6767
- Push your changes to your GitHub repo.
@@ -120,12 +120,21 @@ Note that when running the repository tests using maven or editor, logs will be
120120

121121
- We generally follow this [Java Style Guide](https://google.github.io/styleguide/javaguide.html).
122122

123-
## Sign Your Work
123+
## Developer Certificate of Origin
124124

125-
The sign-off is a simple line at the end of the explanation for the patch. Your signature certifies that you wrote the
126-
patch or otherwise have the right to pass it on as an open-source patch.
125+
To contribute to this repository, you must sign off your commits to certify that you have the right to contribute the
126+
code and that it complies with the open source license.
127+
128+
You can easily do this by adding a "Signed-off-by" line to your commit message to certify your compliance. Please use
129+
your real name as pseudonymous/anonymous contributions are not accepted.
127130

128131
```
129132
Signed-off-by: Holly Smith <holly.smith@email.com>
130133
Use your real name (sorry, no pseudonyms or anonymous contributions.)
131134
```
135+
136+
If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with git commit -s:
137+
138+
```
139+
git commit -s -m "Your commit message"
140+
```

DCO

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Developer's Certificate of Origin 1.1
2+
By making a contribution to this project, I certify that:
3+
(a) The contribution was created in whole or in part by me and I
4+
have the right to submit it under the open source license
5+
indicated in the file; or
6+
(b) The contribution is based upon previous work that, to the best
7+
of my knowledge, is covered under an appropriate open source
8+
license and I have the right under that license to submit that
9+
work with modifications, whether created in whole or in part
10+
by me, under the same open source license (unless I am
11+
permitted to submit under a different license), as indicated
12+
in the file; or
13+
(c) The contribution was provided directly to me by some other
14+
person who certified (a), (b) or (c) and I have not modified
15+
it.
16+
(d) I understand and agree that this project and the contribution
17+
are public and that a record of the contribution (including all
18+
personal information I submit with it, including my sign-off) is
19+
maintained indefinitely and may be redistributed consistent with
20+
this project or the open source license(s) involved.

NEXT_CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# NEXT CHANGELOG
2+
3+
## [Unreleased]
4+
5+
### Added
6+
- Support for token cache in OAuth U2M Flow using the configuration parameters: `EnableTokenCache` and `TokenCachePassPhrase`.
7+
8+
### Updated
9+
-
10+
11+
### Fixed
12+
-
13+
14+
---
15+
*Note: When making changes, please add your change under the appropriate section with a brief description.*

NOTICE

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (2024) Databricks, Inc.
1+
Copyright (2025) Databricks, Inc.
22

33
This Software includes software developed at Databricks (https://www.databricks.com/) and its use is subject to the included LICENSE file.
44

@@ -10,7 +10,7 @@ Copyright (2023) Databricks, Inc.
1010
Notice - https://github.com/databricks/databricks-sdk-java/blob/main/NOTICE
1111

1212
apache/arrow - https://github.com/apache/arrow/tree/main
13-
Copyright 2016-2024 The Apache Software Foundation
13+
Copyright 2016-2025 The Apache Software Foundation
1414
Notice - https://github.com/apache/arrow/blob/main/NOTICE.txt
1515

1616
diffplug/spotless - https://github.com/diffplug/spotless/tree/main
@@ -25,14 +25,14 @@ Copyright (C) 2006 - 2019, The Apache Software Foundation
2525
Notice - https://github.com/apache/thrift/blob/master/NOTICE
2626

2727
apache/commons-io - https://github.com/apache/commons-io
28-
Copyright 2002-2024 The Apache Software Foundation
28+
Copyright 2002-2025 The Apache Software Foundation
2929
Notice - https://github.com/apache/commons-io/blob/master/NOTICE.txt
3030

3131
google/guava - https://github.com/google/guava
3232
Copyright guava authors
3333

3434
apache/logging-log4j2 - https://github.com/apache/logging-log4j2
35-
Copyright 1999-2024 Apache Software Foundation
35+
Copyright 1999-2025 Apache Software Foundation
3636
Notice - https://github.com/apache/logging-log4j2/blob/2.x/NOTICE.txt
3737

3838
FasterXML/jackson-databind - https://github.com/FasterXML/jackson-databind
@@ -45,7 +45,7 @@ FasterXML/jackson-core - https://github.com/FasterXML/jackson-core
4545
Copyright jackson-core authors
4646

4747
immutables/immutable - https://github.com/immutables/immutables
48-
Copyright 2013-2024 Immutables Authors and Contributors
48+
Copyright 2013-2025 Immutables Authors and Contributors
4949

5050
lz4/lz4-java - https://github.com/lz4/lz4-java
5151
Copyright lz4-java authors
@@ -55,7 +55,7 @@ Copyright wiremock authors
5555
Notice - https://github.com/wiremock/wiremock/blob/master/NOTICE.txt
5656

5757
apache/commons-fileupload - https://github.com/apache/commons-fileupload
58-
Copyright 2002-2024 The Apache Software Foundation
58+
Copyright 2002-2025 The Apache Software Foundation
5959
Notice - https://github.com/apache/commons-fileupload/blob/master/NOTICE.txt
6060

6161
________________

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<httpclient.version>4.5.14</httpclient.version>
5555
<commons-configuration.version>2.10.1</commons-configuration.version>
5656
<commons-io.version>2.14.0</commons-io.version>
57-
<databricks-sdk.version>0.44.0</databricks-sdk.version>
57+
<databricks-sdk.version>0.46.0</databricks-sdk.version>
5858
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
5959
<sql-logic-test.version>0.3</sql-logic-test.version>
6060
<lz4-compression.version>1.8.0</lz4-compression.version>

src/main/java/com/databricks/jdbc/api/impl/DatabricksArray.java

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package com.databricks.jdbc.api.impl;
22

33
import com.databricks.jdbc.common.util.DatabricksTypeUtil;
4+
import com.databricks.jdbc.exception.DatabricksDriverException;
5+
import com.databricks.jdbc.exception.DatabricksSQLFeatureNotSupportedException;
46
import com.databricks.jdbc.log.JdbcLogger;
57
import com.databricks.jdbc.log.JdbcLoggerFactory;
8+
import com.databricks.jdbc.model.telemetry.enums.DatabricksDriverErrorCode;
69
import java.math.BigDecimal;
710
import java.sql.Array;
811
import java.sql.Date;
@@ -77,8 +80,13 @@ private Object[] convertElements(List<Object> elements, String elementType) {
7780
convertedElements[i] = convertValue(element, elementType);
7881
}
7982
} catch (Exception e) {
80-
LOGGER.error("Error converting element at index {}: {}", i, e.getMessage(), e);
81-
throw new IllegalArgumentException("Error converting elements", e);
83+
String errorMessage =
84+
String.format("Error converting element at index %s: %s", i, e.getMessage());
85+
LOGGER.error(errorMessage, e);
86+
throw new DatabricksDriverException(
87+
"Error converting elements",
88+
e,
89+
DatabricksDriverErrorCode.COMPLEX_DATA_TYPE_ARRAY_CONVERSION_ERROR);
8290
}
8391
}
8492
return convertedElements;
@@ -126,9 +134,11 @@ private Object convertValue(Object value, String type) {
126134
return value.toString();
127135
}
128136
} catch (Exception e) {
129-
LOGGER.error("Error converting simple value of type {}: {}", type, e.getMessage(), e);
130-
throw new IllegalArgumentException(
131-
"Failed to convert value " + value + " to type " + type, e);
137+
String errorMessage =
138+
String.format("Error converting simple value of type %s: %s", type, e.getMessage());
139+
LOGGER.error(String.format("%s, value : %s", errorMessage, value), e);
140+
throw new DatabricksDriverException(
141+
errorMessage, DatabricksDriverErrorCode.COMPLEX_DATA_TYPE_ARRAY_CONVERSION_ERROR);
132142
}
133143
}
134144

@@ -176,27 +186,28 @@ public void free() throws SQLException {
176186
@Override
177187
public java.sql.ResultSet getResultSet() throws SQLException {
178188
LOGGER.error("getResultSet() not implemented");
179-
throw new UnsupportedOperationException("getResultSet() not implemented");
189+
throw new DatabricksSQLFeatureNotSupportedException("getResultSet() not implemented");
180190
}
181191

182192
@Override
183193
public java.sql.ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
184194
LOGGER.error("getResultSet(Map<String, Class<?>> map) not implemented");
185-
throw new UnsupportedOperationException(
195+
throw new DatabricksSQLFeatureNotSupportedException(
186196
"getResultSet(Map<String, Class<?>> map) not implemented");
187197
}
188198

189199
@Override
190200
public java.sql.ResultSet getResultSet(long index, int count) throws SQLException {
191201
LOGGER.error("getResultSet(long index, int count) not implemented");
192-
throw new UnsupportedOperationException("getResultSet(long index, int count) not implemented");
202+
throw new DatabricksSQLFeatureNotSupportedException(
203+
"getResultSet(long index, int count) not implemented");
193204
}
194205

195206
@Override
196207
public java.sql.ResultSet getResultSet(long index, int count, Map<String, Class<?>> map)
197208
throws SQLException {
198209
LOGGER.error("getResultSet(long index, int count, Map<String, Class<?>> map) not implemented");
199-
throw new UnsupportedOperationException(
210+
throw new DatabricksSQLFeatureNotSupportedException(
200211
"getResultSet(long index, int count, Map<String, Class<?>> map) not implemented");
201212
}
202213

src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.databricks.jdbc.common.util.WildcardUtil;
1313
import com.databricks.jdbc.exception.DatabricksParsingException;
1414
import com.databricks.jdbc.exception.DatabricksSQLException;
15+
import com.databricks.jdbc.exception.DatabricksValidationException;
1516
import com.databricks.jdbc.log.JdbcLogger;
1617
import com.databricks.jdbc.log.JdbcLoggerFactory;
1718
import com.databricks.jdbc.model.telemetry.enums.DatabricksDriverErrorCode;
@@ -153,7 +154,7 @@ public static IDatabricksConnectionContext parse(String url, Properties properti
153154
return new DatabricksConnectionContext(url, hostValue, portValue, schema, propertiesMap);
154155
} else {
155156
// Should never reach here, since we have already checked for url validity
156-
throw new IllegalArgumentException("Invalid url " + "incorrect");
157+
throw new DatabricksValidationException("Connection Context invalid state error");
157158
}
158159
}
159160

@@ -849,6 +850,16 @@ public int getSocketTimeout() {
849850
return Integer.parseInt(getParameter(DatabricksJdbcUrlParams.SOCKET_TIMEOUT));
850851
}
851852

853+
@Override
854+
public String getTokenCachePassPhrase() {
855+
return getParameter(DatabricksJdbcUrlParams.TOKEN_CACHE_PASS_PHRASE);
856+
}
857+
858+
@Override
859+
public boolean isTokenCacheEnabled() {
860+
return getParameter(DatabricksJdbcUrlParams.ENABLE_TOKEN_CACHE).equals("1");
861+
}
862+
852863
private static boolean nullOrEmptyString(String s) {
853864
return s == null || s.isEmpty();
854865
}

0 commit comments

Comments
 (0)