Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
688cf75
Add support for configuring HTTP connection pool size
gopalldb Feb 12, 2025
2e6bfaa
Changes for default value
gopalldb Feb 12, 2025
8ee0fa1
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Feb 21, 2025
5f7d0c1
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Feb 24, 2025
2e28c9e
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Feb 25, 2025
a720802
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Feb 25, 2025
e88657b
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Feb 26, 2025
2670e43
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 1, 2025
c4925ee
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 2, 2025
5a5f1de
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 4, 2025
bf41453
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 5, 2025
b81f4ad
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 6, 2025
1e790a4
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 6, 2025
5ed0c08
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 17, 2025
73029b4
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 19, 2025
ffc2aae
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 27, 2025
7cf9cc8
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Mar 30, 2025
f55ca04
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 2, 2025
ceb2fcb
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 7, 2025
77552fc
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 7, 2025
0690dea
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 7, 2025
638a11a
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 10, 2025
5da3b1e
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 25, 2025
8dbee51
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb Apr 30, 2025
5c72ef9
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb May 8, 2025
b769422
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb May 12, 2025
860a7ff
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb May 14, 2025
3a3e1e4
Add null check in arrow value conversion
gopalldb May 14, 2025
57b6abb
fix comments
gopalldb May 14, 2025
eb1fa9b
add changelog
gopalldb May 14, 2025
4589902
more tests
gopalldb May 15, 2025
aac5322
Merge branch 'main' of github.com:databricks/databricks-jdbc
gopalldb May 15, 2025
c2187d2
Merge branch 'main' into null-arrow
gopalldb May 15, 2025
d5b2945
merge
gopalldb May 15, 2025
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
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

### Fixed
- Fix: unsupported data types in `setObject(int,Object,int targetSqlType)` method in PreparedStatement
- Fix: Added explicit null check for Arrow value vector when the value is empty, and Arrow null checking is disabled.

---
*Note: When making changes, please add your change under the appropriate section with a brief description.*
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public static Object convert(
ColumnInfoTypeName requiredType,
String arrowMetadata)
throws DatabricksSQLException {
// check isNull before getting the object from the vector
if (columnVector.isNull(vectorIndex)) {
return null;
}
Object object = columnVector.getObject(vectorIndex);
if (arrowMetadata != null) {
if (arrowMetadata.startsWith(ARRAY)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.databricks.jdbc.api.impl.converters;

import static com.databricks.jdbc.api.impl.converters.ArrowToJavaObjectConverter.convert;
import static com.databricks.jdbc.api.impl.converters.ArrowToJavaObjectConverter.getZoneIdFromTimeZoneOpt;
import static com.databricks.jdbc.common.util.DatabricksTypeUtil.VARIANT;
import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -43,6 +44,89 @@ public void testNullObjectConversion() throws SQLException {
assertNull(convertedObject);
}

@Test
public void testNullHandlingInVarCharVector() throws Exception {
// Create a VarCharVector with 3 values: non-null, null, and empty string
disableArrowNullChecking();
VarCharVector vector = new VarCharVector("varCharVector", this.bufferAllocator);
vector.allocateNew(4);

// Set first value: "hello"
vector.set(0, "hello".getBytes());

// Second value: null (don't set it, which makes it null by default)

// Third value: empty string (explicitly set as "")
vector.set(2, "".getBytes());

// Fourth value: set to null
vector.setNull(3);

// Set vector value count
vector.setValueCount(4);

// Case 1: Non-null value
assertFalse(vector.isNull(0));
assertEquals("hello", convert(vector, 0, ColumnInfoTypeName.STRING, "STRING"));

// Case 2: Null value
assertTrue(vector.isNull(1));
assertNull(convert(vector, 1, ColumnInfoTypeName.STRING, "STRING"));

// Case 3: Empty string (should not be treated as null)
assertFalse(vector.isNull(2));
assertEquals(
"",
convert(
vector,
2,
ColumnInfoTypeName.STRING,
"STRING")); // Empty string should be empty, not null

// Case 4: Explicitly set to null
assertTrue(vector.isNull(3));
String valueWithoutCheck = (String) convert(vector, 3, ColumnInfoTypeName.STRING, "STRING");
// This assertion is expected to fail - it shows the problem when isNull check is removed
assertNull(valueWithoutCheck);

enableArrowNullChecking();
}

private void disableArrowNullChecking() {
System.setProperty("arrow.enable_null_check_for_get", "false");
}

private void enableArrowNullChecking() {
System.setProperty("arrow.enable_null_check_for_get", "true");
}

@Test
public void testByteVectorWithNullChecks() throws Exception {
TinyIntVector vector = new TinyIntVector("tinyIntVector", this.bufferAllocator);
vector.allocateNew(3);

// First value: explicitly set to null
vector.setNull(0);

// Second value: skip setting it, which makes it null by default

// Third value: set to 0
vector.set(2, 0);

vector.setValueCount(3);

// Test our converter with proper null handling
assertTrue(vector.isNull(0));
assertNull(convert(vector, 0, ColumnInfoTypeName.BYTE, "BYTE"));

assertTrue(vector.isNull(1));
assertNull(convert(vector, 1, ColumnInfoTypeName.BYTE, "BYTE"));

// The zero value should still be correctly identified as 0, not null
assertFalse(vector.isNull(2));
assertEquals((byte) 0, convert(vector, 2, ColumnInfoTypeName.BYTE, "BYTE"));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are not actually testing any change in behaviour in our class, can we instead do verify calls to ensure the appropriate methods are being called when the value vector is null?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still not simulating iceberg library usage. Need to find a better test case for that. Will handle in separate PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test now.


@Test
public void testByteConversion() throws SQLException {
TinyIntVector tinyIntVector = new TinyIntVector("tinyIntVector", this.bufferAllocator);
Expand Down
Loading