Repository navigation
[PECOBLR-126] added DefaultStringColumnLength config - #761
Conversation
| if (isTextType(typeVal)) { | ||
| return DatabricksThreadContextHolder.getConnectionContext() | ||
| .getDefaultStringColumnLength(); | ||
| } |
There was a problem hiding this comment.
getCharOctetLength has nothing to do with the set defaultStringLength - it is just the column property.
VARCHAR(20) means the column in the table can only store upto 20 characters. If you try storing more than 20 characters in the column, then it will be truncated.
Is there any particular reason you added this change?
There was a problem hiding this comment.
getCharOctetLength has nothing to do with the set defaultStringLength
No, CHAR_OCTET_LENGTH also gets set with defaultStringLength.
this code is triggered only when size info is not there in typeVal. For VARCHAR(20), code below is executed and CHAR_OCTET_LENGTH is set according to size.
Also, as i mentioned in PR description, defaultStringLength config only affects STRING columns only, where size is not defined at time of column creation.
There was a problem hiding this comment.
It also depends on encoding. Since Databricks uses UTF-8 by default, shouldn't the octet_length be 4*length?
There was a problem hiding this comment.
I verified output with legacy driver. doesn't seem to be the case
| int scale = DatabricksTypeUtil.getScale(columnType); | ||
| int[] result = getBaseScaleAndPrecision(columnType); | ||
| if (columnInfo.getTypePrecision() != null) { | ||
| precision = Math.toIntExact(columnInfo.getTypePrecision()); |
There was a problem hiding this comment.
you call the method as scale and precision, shouldn't scale be 1st part and precision 2nd?
There was a problem hiding this comment.
updated function name
| /* | ||
| * Returns default scale and precision based on column type. For string columns, returns the default string col length. | ||
| */ | ||
| public static int[] getBaseScaleAndPrecision(int columnType) { |
There was a problem hiding this comment.
This is confusing. The javadoc also says scale and precision, but you are returning precision and scale. Can you either change the order or update the method name and javadoc comment
There was a problem hiding this comment.
updated function name
| Mockito.when(resultSet.next()).thenReturn(true).thenReturn(false); | ||
| Mockito.when(resultSet.getObject(TABLE_TYPE_COLUMN.getResultSetColumnName())) | ||
| when(resultSet.next()).thenReturn(true).thenReturn(false); | ||
| when(resultSet.getObject(TABLE_TYPE_COLUMN.getResultSetColumnName())) |
| Mockito.when(resultSet.next()).thenReturn(true).thenReturn(false); | ||
| Mockito.when(resultSet.getObject(IS_NULLABLE_COLUMN.getResultSetColumnName())) | ||
| when(resultSet.next()).thenReturn(true).thenReturn(false); | ||
| when(resultSet.getObject(IS_NULLABLE_COLUMN.getResultSetColumnName())) |
| Mockito.when(resultSet.getString(COLUMN_TYPE_COLUMN.getResultSetColumnName())) | ||
| .thenReturn(typeName); | ||
| when(resultSet.next()).thenReturn(true).thenReturn(false); | ||
| when(resultSet.getString(COLUMN_TYPE_COLUMN.getResultSetColumnName())).thenReturn(typeName); |
| if (typeVal.contains(BINARY_TYPE)) { | ||
| return 32767; | ||
| } else { | ||
| if (isTextType(typeVal)) { |
There was a problem hiding this comment.
VARCHAR type covers this case.
Arguments.of("VARCHAR", 255),
* [PECOBLR-272] Retry handler fixes for http client (#764) * Support Azure Managed Identity OAuth in OSS JDBC (#756) * draft for azure msi * add unit tests * remove debug line * fmt * Address comments * Add debug logs * [PECOBLR-262] implement todos in DBFS volume client (#763) * [PECOBLR-182] Add support for retry timeout for UC vol operations (#760) * Add support for retry timeout for UC vol operations * [PECOBLR-161][PECOBLR-282] add support for configurable row fetch limit in thrift inline and fix setMaxRows (#765) * [PECOBLR-126] added DefaultStringColumnLength config (#761) * Add client-side statement execution timeout (#767) ## Description - DatabricksStatement uses the same-thread executor for the statement's CompletableFuture. By the time the code reaches the `futureResultSet.get(timeoutInSeconds, TimeUnit.SECONDS)` line, the task has already fully executed (or failed), so the timeout has no practical effect. - Create a reusable TimeoutHandler utility class that centralizes timeout logic. - Implement timeout checks during statement execution polling instead of relying on the CompletableFuture timeout. - Add automatic cancellation of statements when timeouts occur. - Ensure consistent timeout behavior across both SDK and Thrift client implementations. - Move the DatabricksSdkClientTest class to the test counterpart of its source package. Delete the duplicate DatabricksSdkClientTest class. - DatabricksThriftAccessor will now use connection param `asyncPollIntervalMillis`. Previously, the poll interval was hardcoded to 1 second. ## Testing - Unit tests - E2E testing * [PECOBLR-106][PECOBLR-235] Fixes Logging Test intermittent failures and adds support for thriftclient in test (#766) * logging fixes * fix logging test * fix logging test * fix logging test * fix logging test * fix logging test * use printf in place of echo * use powershell * try java side fix * fix comments * minor fixes * Hybrid Results are enabled by default in SEA Mode (#771) * Made Hybrid results default * Fixed unit test * Added Fake service stubs * Added stubs for Default hybrid mode * Reverted to old stubs * Reverted stubs * Fix * [PECOBLR-289] Throw exception for column not found (#773) * [PECOBLR-145] Implement OAuth2RedirectUrlPort (#775) * Support for providing custom headers from URL (#776) * Support for custom headers * Made headers case insensitive * Added back the case matching in headers * Formatting fix * Align behaviour for ResultSet#getBoolean (#774) * Update version to 1.0.3 (#772) * make changes for 1.0.3 release * adds changelog * updates changelog * updates changelog * updates changelog * [PECOBLR-239][PECOBLR-279] added sql types integration tests (#769) * added edge cases for string and null * update stubs * add test for variant type * add test for timestamp * [PECOBLR-310] Refactor internal interfaces into internal package, and fix javadoc for public interfaces (#770) * Fix javadoc for all public interfaces * [PECOBLR-164] Support connection param SocketTimeout (#777) - The default value of the param is kept as 900 seconds (same as earlier value and default in databricks-sdk-java) - Set the param in thrift, dbfs, and sql-exec clients * Renaming UC Volume retryable codes and retry timeout parameters as per Docs team feedback (#780) * Rename UC timeout and retryable parameters based on Docs team feedback * Set default value as null for BigDecimal (#782) * [PECOBLR-322] Update SDK to the latest version (0.43.0) (#781) * [PECOBLR-301] Handle server returned Thrift version as part of open session response gracefully (#779) * init changes * Refactor TSparkArrowTypes initialization based on protocol version * added comments * added several unit tests * added more unit tests * ran ProtocolFeatureUtilTest for all protocol versions * store protocol version as TProtocolVersion enum. * move db compute check to protocol feature util --------- Co-authored-by: Vikrant Puppala <[email protected]> Co-authored-by: Shivam Raj <[email protected]> Co-authored-by: Gopal Lal <[email protected]> Co-authored-by: jayant <[email protected]> Co-authored-by: Madhav Sainanee <[email protected]> Co-authored-by: Jothi Prakash <[email protected]>
* [PECOBLR-272] Retry handler fixes for http client (#764) * Support Azure Managed Identity OAuth in OSS JDBC (#756) * draft for azure msi * add unit tests * remove debug line * fmt * Address comments * Add debug logs * [PECOBLR-262] implement todos in DBFS volume client (#763) * [PECOBLR-182] Add support for retry timeout for UC vol operations (#760) * Add support for retry timeout for UC vol operations * [PECOBLR-161][PECOBLR-282] add support for configurable row fetch limit in thrift inline and fix setMaxRows (#765) * [PECOBLR-126] added DefaultStringColumnLength config (#761) * Add client-side statement execution timeout (#767) ## Description - DatabricksStatement uses the same-thread executor for the statement's CompletableFuture. By the time the code reaches the `futureResultSet.get(timeoutInSeconds, TimeUnit.SECONDS)` line, the task has already fully executed (or failed), so the timeout has no practical effect. - Create a reusable TimeoutHandler utility class that centralizes timeout logic. - Implement timeout checks during statement execution polling instead of relying on the CompletableFuture timeout. - Add automatic cancellation of statements when timeouts occur. - Ensure consistent timeout behavior across both SDK and Thrift client implementations. - Move the DatabricksSdkClientTest class to the test counterpart of its source package. Delete the duplicate DatabricksSdkClientTest class. - DatabricksThriftAccessor will now use connection param `asyncPollIntervalMillis`. Previously, the poll interval was hardcoded to 1 second. ## Testing - Unit tests - E2E testing * [PECOBLR-106][PECOBLR-235] Fixes Logging Test intermittent failures and adds support for thriftclient in test (#766) * logging fixes * fix logging test * fix logging test * fix logging test * fix logging test * fix logging test * use printf in place of echo * use powershell * try java side fix * fix comments * minor fixes * Hybrid Results are enabled by default in SEA Mode (#771) * Made Hybrid results default * Fixed unit test * Added Fake service stubs * Added stubs for Default hybrid mode * Reverted to old stubs * Reverted stubs * Fix * [PECOBLR-289] Throw exception for column not found (#773) * [PECOBLR-145] Implement OAuth2RedirectUrlPort (#775) * Support for providing custom headers from URL (#776) * Support for custom headers * Made headers case insensitive * Added back the case matching in headers * Formatting fix * Align behaviour for ResultSet#getBoolean (#774) * Update version to 1.0.3 (#772) * make changes for 1.0.3 release * adds changelog * updates changelog * updates changelog * updates changelog * [PECOBLR-239][PECOBLR-279] added sql types integration tests (#769) * added edge cases for string and null * update stubs * add test for variant type * add test for timestamp * [PECOBLR-310] Refactor internal interfaces into internal package, and fix javadoc for public interfaces (#770) * Fix javadoc for all public interfaces * [PECOBLR-164] Support connection param SocketTimeout (#777) - The default value of the param is kept as 900 seconds (same as earlier value and default in databricks-sdk-java) - Set the param in thrift, dbfs, and sql-exec clients * Renaming UC Volume retryable codes and retry timeout parameters as per Docs team feedback (#780) * Rename UC timeout and retryable parameters based on Docs team feedback * Set default value as null for BigDecimal (#782) * [PECOBLR-322] Update SDK to the latest version (0.43.0) (#781) * [PECOBLR-301] Handle server returned Thrift version as part of open session response gracefully (#779) * init changes * Refactor TSparkArrowTypes initialization based on protocol version * added comments * added several unit tests * added more unit tests * ran ProtocolFeatureUtilTest for all protocol versions * store protocol version as TProtocolVersion enum. * move db compute check to protocol feature util --------- Co-authored-by: Vikrant Puppala <[email protected]> Co-authored-by: Shivam Raj <[email protected]> Co-authored-by: Gopal Lal <[email protected]> Co-authored-by: jayant <[email protected]> Co-authored-by: Madhav Sainanee <[email protected]> Co-authored-by: Jothi Prakash <[email protected]>
Description
Added DefaultStringColumnLength to url params. default value is 255.
based on findings from legacy driver:
Testing
unit test
driver test
Additional Notes to the Reviewer