Documentation
¶
Index ¶
- func ConvertToAvroCompatibleName(columnName string) string
- func DefaultTime(dwh protos.DBType) time.Time
- func DetermineNumericSettingForDWH(precision int16, scale int16, dwh protos.DBType) (int16, int16)
- func Equals(qv types.QValue, other types.QValue) bool
- func GetAvroSchemaFromQValueKind(ctx context.Context, env map[string]string, kind types.QValueKind, ...) (avro.Schema, error)
- func NullableAvroSchema(schema avro.Schema) (avro.Schema, error)
- func QValueToAvro(ctx context.Context, value types.QValue, field *types.QField, ...) (any, int64, error)
- func ShouldUseNativeJSONType(ctx context.Context, env map[string]string, chVersion *chproto.Version) bool
- func ToDWHColumnType(ctx context.Context, kind types.QValueKind, env map[string]string, ...) (string, error)
- func TruncateNumeric(num decimal.Decimal, targetPrecision, targetScale int16, ...) (decimal.Decimal, int, bool)
- type NumericDestinationType
- type NumericStat
- type QValueAvroConverter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToAvroCompatibleName ¶
ConvertToAvroCompatibleName converts a column name to a field name that is compatible with Avro.
func GetAvroSchemaFromQValueKind ¶
func GetAvroSchemaFromQValueKind( ctx context.Context, env map[string]string, kind types.QValueKind, targetDWH protos.DBType, precision int16, scale int16, ) (avro.Schema, error)
GetAvroSchemaFromQValueKind returns the Avro schema for a given QValueKind. The function takes in two parameters, a QValueKind and a boolean indicating if the Avro schema should respect null values. It returns a QValueKindAvroSchema object representing the Avro schema and an error if the QValueKind is unsupported.
For example, QValueKindInt64 would return an AvroLogicalSchema of "long". Unsupported QValueKinds will return an error.
func QValueToAvro ¶
func ShouldUseNativeJSONType ¶
func ToDWHColumnType ¶
func TruncateNumeric ¶
func TruncateNumeric( num decimal.Decimal, targetPrecision, targetScale int16, targetDWH protos.DBType, stat *NumericStat, ) (decimal.Decimal, int, bool)
TruncateNumeric truncates a decimal to fit within the target precision and scale. Returns the truncated decimal, the number of integer digits, and whether truncation succeeded. If ok is false, the value was too large and should be treated as zero.
Types ¶
type NumericDestinationType ¶
func GetNumericDestinationType ¶
func GetNumericDestinationType( precision, scale int16, targetDWH protos.DBType, unboundedNumericAsString bool, ) NumericDestinationType
type NumericStat ¶
type NumericStat struct {
DestinationTable string
DestinationColumn string
TruncatedCount uint64
MaxExponent int32
LongIntegersClearedCount uint64
MaxIntegerDigits int32
BigInt256ClearedCount uint64
}
func NewNumericStat ¶
func NewNumericStat(destinationTable, destinationColumn string) NumericStat
func (*NumericStat) CollectWarnings ¶
func (ns *NumericStat) CollectWarnings(warnings *shared.QRepWarnings)