MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / arrowTypeToMySqlStr

Function arrowTypeToMySqlStr

plugins/destination/mysql/client/types.go:106–146  ·  view source on GitHub ↗
(t arrow.DataType)

Source from the content-addressed store, hash-verified

104}
105
106func arrowTypeToMySqlStr(t arrow.DataType) string {
107 switch t.(type) {
108 case *arrow.BooleanType:
109 // we can use `bool` which is an alias for `tinyint(1)` but since MySQL information schema returns `tinyint(1)` we use it here as well
110 // to be aligned with `mySQLTypeToArrowType`
111 return "tinyint(1)"
112 case *arrow.Int8Type:
113 return "tinyint"
114 case *arrow.Int16Type:
115 return "smallint"
116 case *arrow.Int32Type:
117 return "int"
118 case *arrow.Int64Type:
119 return "bigint"
120 case *arrow.Uint8Type:
121 return "tinyint unsigned"
122 case *arrow.Uint16Type:
123 return "smallint unsigned"
124 case *arrow.Uint32Type:
125 return "int unsigned"
126 case *arrow.Uint64Type:
127 return "bigint unsigned"
128 case *arrow.Float32Type:
129 return "float"
130 case *arrow.Float64Type:
131 return "double"
132 case *arrow.StringType, *arrow.LargeStringType:
133 return "text"
134 case *arrow.BinaryType, *arrow.LargeBinaryType:
135 return "blob"
136 // nolint:typecheck
137 case *types.UUIDType:
138 return "binary(16)"
139 case *arrow.TimestampType:
140 return "datetime(6)"
141 case *arrow.StructType, *arrow.ListType, *types.JSONType:
142 return "json"
143 default:
144 return "text"
145 }
146}

Callers 4

addColumnMethod · 0.85
createTableMethod · 0.85
normalizeColumnMethod · 0.85
writeResourcesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected