From 9bdebf428aaf41b566bb376fa847d5fb84cce079 Mon Sep 17 00:00:00 2001 From: Gal Topper Date: Mon, 30 Sep 2024 16:54:07 +0800 Subject: [PATCH] 1.7.x (#542) * Raise maximum pyarrow version to 17 (the latest) (#538) [ML-7946](https://iguazio.atlassian.net/browse/ML-7946) * Fix parsing of results from TDEngine DESCRIBE [1.7.x] (#541) [ML-7985](https://iguazio.atlassian.net/browse/ML-7985) --- storey/dtypes.py | 24 ++++++++++++++---------- storey/targets.py | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/storey/dtypes.py b/storey/dtypes.py index d9a98d49..dbe1abb7 100644 --- a/storey/dtypes.py +++ b/storey/dtypes.py @@ -14,7 +14,7 @@ from datetime import datetime, timezone from enum import Enum -from typing import Callable, List, Literal, NamedTuple, Optional, Union +from typing import Callable, List, Optional, Union import numpy @@ -456,12 +456,16 @@ class FixedWindowType(Enum): LastClosedWindow = 2 -class _TDEngineField(NamedTuple): - field: str - # https://docs.tdengine.com/reference/taos-sql/data-type/ - type: Literal["TIMESTAMP", "INT", "FLOAT", "DOUBLE", "BINARY", "BOOL", "NCHAR", "JSON", "VARCHAR"] - length: int - note: Literal["", "TAG"] - encode: str - compress: str - level: str +class _TDEngineField: + def __init__( + self, + field: str, + field_type: str, + length: int, + note: str, + *args, + ): + self.field = field + self.field_type = field_type + self.length = length + self.note = note diff --git a/storey/targets.py b/storey/targets.py index d5f5377b..75b3c367 100644 --- a/storey/targets.py +++ b/storey/targets.py @@ -948,7 +948,7 @@ def _get_table_schema( reg_cols_schema = [] for field in fields: field_name = field.field - field_type = field.type + field_type = field.field_type if field.note == "TAG": if field_type in self._tdengine_type_to_tag_func: