Skip to content
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

adds a fix to type array to databricks, array types used to carry the… #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package liquibase.ext.databricks.datatype;

import liquibase.change.core.LoadDataChange;
import liquibase.database.Database;
import liquibase.datatype.DataTypeInfo;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;
import liquibase.ext.databricks.database.DatabricksDatabase;
import liquibase.servicelocator.PrioritizedService;

@DataTypeInfo(
name = "array<string>",
minParameters = 0,
maxParameters = 0,
priority = PrioritizedService.PRIORITY_DATABASE
)
public class ArrayDatatypeDatabricks extends LiquibaseDataType {

public ArrayDatatypeDatabricks() {
// empty constructor
}

@Override
public boolean supports(Database database) {
return database instanceof DatabricksDatabase;
}

@Override
public DatabaseDataType toDatabaseDataType(Database database) {
if (database instanceof DatabricksDatabase) {

DatabaseDataType type = new DatabaseDataType("ARRAY<STRING>", this.getParameters());
type.setType("ARRAY<STRING>");
return type;
} else {
return super.toDatabaseDataType(database);
}

}

public LoadDataChange.LOAD_DATA_TYPE getLoadTypeName() {
return LoadDataChange.LOAD_DATA_TYPE.STRING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ liquibase.ext.databricks.datatype.IntegerDatatypeDatabricks
liquibase.ext.databricks.datatype.BooleanDatatypeDatabricks
liquibase.ext.databricks.datatype.FloatDatatypeDatabricks
liquibase.ext.databricks.datatype.DoubleDatatypeDatabricks
liquibase.ext.databricks.datatype.ArrayDatatypeDatabricks
Loading