mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
removed getSize() and enhanced docs
This commit is contained in:
parent
e14a7f066a
commit
9a2d89e3e4
@ -2465,7 +2465,16 @@ This function is designed to load a NumPy array from a .npy file into ClickHouse
|
||||
| S | String |
|
||||
| U | String |
|
||||
|
||||
**Example**
|
||||
**Example of saving an array in .npy format using Python**
|
||||
|
||||
|
||||
```Python
|
||||
import numpy as np
|
||||
arr = np.array([[[1],[2],[3]],[[4],[5],[6]]])
|
||||
np.save('example_array.npy', arr)
|
||||
```
|
||||
|
||||
**Example of reading a NumPy file in ClickHouse**
|
||||
|
||||
Query:
|
||||
```sql
|
||||
|
@ -39,7 +39,6 @@ public:
|
||||
|
||||
Endianness getEndianness() const { return endianness; }
|
||||
|
||||
virtual size_t getSize() const = 0;
|
||||
virtual NumpyDataTypeIndex getTypeIndex() const = 0;
|
||||
|
||||
private:
|
||||
@ -66,7 +65,6 @@ public:
|
||||
{
|
||||
return type_index;
|
||||
}
|
||||
size_t getSize() const override { return size; }
|
||||
bool isSigned() const { return is_signed; }
|
||||
|
||||
private:
|
||||
@ -92,8 +90,6 @@ public:
|
||||
{
|
||||
return type_index;
|
||||
}
|
||||
size_t getSize() const override { return size; }
|
||||
|
||||
private:
|
||||
size_t size;
|
||||
};
|
||||
@ -107,7 +103,7 @@ public:
|
||||
}
|
||||
|
||||
NumpyDataTypeIndex getTypeIndex() const override { return type_index; }
|
||||
size_t getSize() const override { return size; }
|
||||
size_t getSize() const { return size; }
|
||||
private:
|
||||
size_t size;
|
||||
};
|
||||
@ -121,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
NumpyDataTypeIndex getTypeIndex() const override { return type_index; }
|
||||
size_t getSize() const override { return size * 4; }
|
||||
size_t getSize() const { return size * 4; }
|
||||
private:
|
||||
size_t size;
|
||||
};
|
||||
|
@ -339,9 +339,9 @@ void NpyRowInputFormat::readAndInsertString(MutableColumnPtr column, const DataT
|
||||
{
|
||||
size_t size;
|
||||
if (npy_type.getTypeIndex() == NumpyDataTypeIndex::String)
|
||||
size = npy_type.getSize();
|
||||
size = assert_cast<const NumpyDataTypeString &>(npy_type).getSize();
|
||||
else if (npy_type.getTypeIndex() == NumpyDataTypeIndex::Unicode)
|
||||
size = npy_type.getSize();
|
||||
size = assert_cast<const NumpyDataTypeUnicode &>(npy_type).getSize();
|
||||
else
|
||||
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot insert data type into column with type {}",
|
||||
data_type->getName());
|
||||
|
Loading…
Reference in New Issue
Block a user