diff --git a/clients/databricks/dialect/dialect.go b/clients/databricks/dialect/dialect.go index 32d0ff02c..f932ddf49 100644 --- a/clients/databricks/dialect/dialect.go +++ b/clients/databricks/dialect/dialect.go @@ -37,8 +37,8 @@ func (DatabricksDialect) BuildAlterColumnQuery(tableID sql.TableIdentifier, colu return fmt.Sprintf("ALTER TABLE %s %s COLUMN %s", tableID.FullyQualifiedName(), columnOp, colSQLPart) } -func (DatabricksDialect) BuildIsNotToastValueExpression(tableAlias constants.TableAlias, column columns.Column) string { - colName := sql.QuoteTableAliasColumn(tableAlias, column, sd) +func (d DatabricksDialect) BuildIsNotToastValueExpression(tableAlias constants.TableAlias, column columns.Column) string { + colName := sql.QuoteTableAliasColumn(tableAlias, column, d) if column.KindDetails == typing.Struct { return fmt.Sprintf("COALESCE(%s != {'key': '%s'}, true)", colName, constants.ToastUnavailableValuePlaceholder) } diff --git a/clients/databricks/dialect/typing.go b/clients/databricks/dialect/typing.go index f70a5c99e..c022cb2e7 100644 --- a/clients/databricks/dialect/typing.go +++ b/clients/databricks/dialect/typing.go @@ -16,7 +16,7 @@ func (DatabricksDialect) DataTypeForKind(kindDetails typing.KindDetails, _ bool) case typing.Integer.Kind: return "BIGINT" case typing.Struct.Kind: - return "VARIANT" + return "STRING" case typing.Array.Kind: // Databricks requires arrays to be typed. As such, we're going to use an array of strings. return "ARRAY" @@ -56,7 +56,7 @@ func (DatabricksDialect) KindForDataType(rawType string, _ string) (typing.KindD } switch rawType { - case "string", "binary": + case "string", "binary", "variant", "object": return typing.String, nil case "bigint": return typing.KindDetails{Kind: typing.Integer.Kind, OptionalIntegerKind: typing.ToPtr(typing.BigIntegerKind)}, nil @@ -74,8 +74,6 @@ func (DatabricksDialect) KindForDataType(rawType string, _ string) (typing.KindD return typing.NewKindDetailsFromTemplate(typing.ETime, ext.TimestampTzKindType), nil case "timestamp_ntz": return typing.NewKindDetailsFromTemplate(typing.ETime, ext.TimestampTzKindType), nil - case "variant", "object": - return typing.Struct, nil } return typing.Invalid, fmt.Errorf("unsupported data type: %q", rawType)