Repository navigation
fix(go): correct ingestion and validation fixtures #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Copyright (c) 2026 ADBC Drivers Contributors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package databricks | ||
|
|
||
| import ( | ||
| "errors" | ||
|
|
||
| "github.com/apache/arrow-adbc/go/adbc" | ||
| dbsqlerr "github.com/databricks/databricks-sql-go/errors" | ||
| ) | ||
|
|
||
| type DatabricksErrorInspector struct { | ||
| ingest bool | ||
| } | ||
|
|
||
| // InspectError maps Databricks execution errors to ADBC errors and preserves SQLSTATE. | ||
| func (d DatabricksErrorInspector) InspectError(err error, defaultStatus adbc.Status) adbc.Error { | ||
| adbcErr := adbc.Error{Code: defaultStatus, Msg: err.Error()} | ||
| var executionErr dbsqlerr.DBExecutionError | ||
| for errors.As(err, &executionErr) { | ||
| if sqlState := executionErr.SqlState(); sqlState != "" { | ||
| copy(adbcErr.SqlState[:], sqlState) | ||
| switch sqlState { | ||
| case "42P07": // TABLE_OR_VIEW_ALREADY_EXISTS | ||
| adbcErr.Code = adbc.StatusAlreadyExists | ||
| case "42703": // UNRESOLVED_COLUMN | ||
| adbcErr.Code = adbc.StatusInvalidArgument | ||
| if d.ingest { | ||
| // A missing destination column means the existing table's | ||
| // schema conflicts with the ingest input. | ||
| adbcErr.Code = adbc.StatusAlreadyExists | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — In ingest mode, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — During ingest, a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔵 Low — During ingest, SQLSTATE |
||
| } | ||
| } | ||
| break | ||
| } | ||
| // A wrapper may have no SQLSTATE even when its cause has one. | ||
| err = errors.Unwrap(executionErr) | ||
| } | ||
| return adbcErr | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # DECIMAL scale must be between zero and precision. | ||
| # https://docs.databricks.com/aws/en/sql/language-manual/data-types/decimal-type | ||
| hide = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (c) 2026 ADBC Drivers Contributors | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| // part: metadata | ||
|
|
||
| [tags] | ||
| sql-type-name = "DOUBLE" | ||
|
|
||
| // part: setup_query | ||
|
|
||
| CREATE TABLE test_float64 (res DOUBLE); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Databricks timestamp precision starts at 6 fractional digits. | ||
| # https://docs.databricks.com/aws/en/sql/language-manual/data-types/timestamp-type | ||
| hide = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Databricks timestamp precision starts at 6 fractional digits. | ||
| # https://docs.databricks.com/aws/en/sql/language-manual/data-types/timestamp-type | ||
| hide = true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Copyright (c) 2026 ADBC Drivers Contributors | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| # Databricks timestamp precision starts at 6 fractional digits. | ||
| # https://docs.databricks.com/aws/en/sql/language-manual/data-types/timestamp-type | ||
| hide = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔵 Low — This PR adds dictionary-encoded array support to the parameter-binding path (
parameterValueType+ the newarrow.DICTIONARYcase inarrowValueToParameter), but the ingest path is left asymmetric.extractGoValuehas noDICTIONARYcase, so it falls through to thedefaultbranch and returnsunsupported Arrow type;arrowTypeToDatabricksTypesimilarly falls back toSTRINGfor a dictionary column. As a result, binding the same dictionary-encoded Arrow data succeeds forExecuteQuery/ExecuteUpdatebut fails for ingestion. If dictionary ingestion is intentionally out of scope for this PR, consider resolving the value type here too (mirroringparameterValueType) in a follow-up, or at least documenting the gap.(Anchored to the nearest changed line — see the description for the exact location.)