Skip to content

Commit

Permalink
Merge pull request housepower#48 from FourSpaces/master
Browse files Browse the repository at this point in the history
Resolve insertion materialization reporting errors.
  • Loading branch information
sundy-li authored Apr 7, 2020
2 parents 9d52fe4 + 814c1c3 commit 2856720
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions output/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,18 @@ func (c *ClickHouse) initSchema() (err error) {
if c.AutoSchema {
conn := pool.GetConn(c.Host)
rs, err := conn.Query(fmt.Sprintf(
"select name, type from system.columns where database = '%s' and table = '%s'", c.DB, c.TableName))
"select name, type, default_kind from system.columns where database = '%s' and table = '%s'", c.DB, c.TableName))
if err != nil {
return err
}

c.Dims = make([]*model.ColumnWithType, 0, 10)
c.Metrics = make([]*model.ColumnWithType, 0, 10)
var name, typ string
var name, typ, defaultKind string
for rs.Next() {
_ = rs.Scan(&name, &typ)
_ = rs.Scan(&name, &typ, &defaultKind)
typ = lowCardinalityRegexp.ReplaceAllString(typ, "$1")
if !util.StringContains(c.ExcludeColumns, name) {
if !util.StringContains(c.ExcludeColumns, name) && defaultKind != "MATERIALIZED" {
c.Dims = append(c.Dims, &model.ColumnWithType{Name: name, Type: typ})
}
}
Expand Down

0 comments on commit 2856720

Please sign in to comment.