(ctx context.Context, databaseName, tableName string)
| 181 | } |
| 182 | |
| 183 | func (d *Driver) getPartitions(ctx context.Context, databaseName, tableName string) ([]*storepb.TablePartitionMetadata, error) { |
| 184 | // partitions. |
| 185 | partitionResult, err := d.queryStatementWithLimit(ctx, fmt.Sprintf("SHOW PARTITIONS `%s`.`%s`", databaseName, tableName), 0) |
| 186 | if err != nil { |
| 187 | slog.Debug("failed to get partitions", log.BBError(err)) |
| 188 | return nil, nil |
| 189 | } |
| 190 | if partitionResult == nil { |
| 191 | return nil, nil |
| 192 | } |
| 193 | var partitions []*storepb.TablePartitionMetadata |
| 194 | for _, row := range partitionResult.Rows { |
| 195 | if row == nil || len(row.Values) == 0 { |
| 196 | return nil, errors.New("partitions result row has zero length") |
| 197 | } |
| 198 | partitions = append(partitions, &storepb.TablePartitionMetadata{ |
| 199 | Name: row.Values[0].GetStringValue(), |
| 200 | }) |
| 201 | } |
| 202 | return partitions, nil |
| 203 | } |
| 204 | |
| 205 | // This function gets certain database info by name. |
| 206 | func (d *Driver) getDatabaseInfoByName(ctx context.Context, databaseName string) (*storepb.SchemaMetadata, error) { |
no test coverage detected