StarRocks/dbt-starrocks

StarRocksColumn(Column) has a bug in treating String fields

mcgray opened this issue · 1 comments

SR version of Column does not override parent's string_type which means that we are using "character varying" as a type name for String fields. This type does not exist in SR.

Steps to reproduce

  1. Create any table
  2. Try to add a column to a table via:
{{
    config(
        materialized='incremental',
        on_schema_change='append_new_columns'
    )
}}
select
    cast(NULL as varchar) as `atp_new`
    where false
  1. Observe logs:
    add column atp_new character varying(1048576)

  2. DBT run finished with error

Expected behavior

1, 2 as above
Logs should show something like:
add column atp_new varchar(65535)

And run should finish with success.

Versions

Core:
  - installed: 1.6.11
  - latest:    1.7.11 - Update available!

  Your version of dbt-core is out of date!
  You can find instructions for upgrading here:
  https://docs.getdbt.com/docs/installation

Plugins:
  - starrocks: 1.6.1 - Up to date!

Suggested fix

@classmethod
    def string_type(cls, size: int) -> str:
        return "varchar({})".format(size)

Can you submit a pr?