<@U0A71G31CDV> how do i fix this error? ```parquet...
# questions-and-troubleshooting
j
@Rocky how do i fix this error?
Copy code
parquet column reader: not supported convert from parquet `FIXED_LEN_BYTE_ARRAY` to `VARBINARY`
r
The error message
parquet column reader: not supported convert from parquet FIXED_LEN_BYTE_ARRAY to VARBINARY
occurs because the StarRocks Parquet reader currently supports direct mapping to
VARBINARY
only from Parquet's
BYTE_ARRAY
(variable-length) type, and not from its
FIXED_LEN_BYTE_ARRAY
(fixed-length) type. In Parquet,
FIXED_LEN_BYTE_ARRAY
is commonly used for two things: High-precision Decimals or Fixed-size Binary data (like UUIDs or Hashes). Depending on what your data actually is, here are the ways to fix this: 1. If the column is actually a Decimal If the Parquet file was generated from a system that stores Decimals (especially Decimal128) as fixed-length byte arrays, you should change the column type in your StarRocks table to
DECIMAL
. * Fix: Alter your table or recreation script to use
DECIMAL(precision, scale)
instead of
VARBINARY
. 2. If the column is fixed-length Binary data (e.g., UUIDs) If the data is truly binary but stored in a fixed-length format in Parquet, StarRocks' reader currently doesn't support the automatic conversion to the
VARBINARY
type. * Workaround (Use VARCHAR): Change the StarRocks column type to
VARCHAR
. StarRocks can often read fixed-length binary arrays as strings. Once loaded, you can use functions like
hex()
or
base64()
to process the data if needed. * Workaround (Change Source): If you have control over how the Parquet file is created, try saving that column as a standard
BYTE_ARRAY
(variable length binary) instead of
FIXED_LEN_BYTE_ARRAY
. 3. If using
FILES()
or External Tables
If you are using the
FILES()
table function or an External Catalog and cannot change the schema easily, you can try to cast the column explicitly in your SQL query, though the reader error may still persist if it hits the column during the initial scan. * Example:
SELECT CAST(col AS VARCHAR) FROM FILES(...)
Summary of Support: * Supported:
parquet::BYTE_ARRAY
->
StarRocks::VARBINARY
* Not Supported:
parquet::FIXED_LEN_BYTE_ARRAY
->
StarRocks::VARBINARY
(This is a known limitation in the current C++ reader). Referencessql-reference/data-types/semi_structured/VARIANT.mdsql-reference/data-types/string-type/BINARY.mdsql-reference/sql-functions/table-functions/files.mdadministration/management/FE_configuration.mdunloading/Flink_connector.md
j
@Rocky how do i read a uuid column from iceberg?
r
Hello! I'm Rocky. Dealing with
UUID
columns from Iceberg in StarRocks depends slightly on your version, as the mapping behavior was updated recently to improve consistency and performance. Here is how you can read a UUID column: 1. Data Type Mapping * StarRocks v3.3.11 and later: The Iceberg
UUID
type is automatically mapped to the
VARBINARY
type in StarRocks. * Earlier Versions: It was typically mapped to
STRING
(VARCHAR) or might have required manual mapping if using the older "External Table" syntax. 2. How to Read/Query If you are on a recent version where it is mapped to
VARBINARY
, a simple
SELECT uuid_col
might display the raw binary or a hex representation depending on your SQL client settings. To ensure it is human-readable, you should use the
hex()
function:
Copy code
sql
SELECT hex(uuid_column) FROM iceberg_catalog.db.table_name;
3. Formatting as a Standard UUID String StarRocks stores the UUID as a 16-byte binary. If you need it in the standard hyphenated format (
aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
), you can use string manipulation:
Copy code
sql
SELECT 
    lower(concat_ws('-', 
        left(hex(uuid_col), 8), 
        substr(hex(uuid_col), 9, 4), 
        substr(hex(uuid_col), 13, 4), 
        substr(hex(uuid_col), 17, 4), 
        right(hex(uuid_col), 12)
    )) AS formatted_uuid
FROM iceberg_catalog.db.table_name;
Summary Tips: * Check the Schema: Use
DESC <table_name>
to see if the column is currently interpreted as
VARBINARY
or
VARCHAR
. * Filtering: You can filter using hex strings:
WHERE uuid_col = unhex('550e8400e29b41d4a716446655440000')
. * Catalog: Ensure you are using the Iceberg Catalog (recommended) rather than the deprecated External Table syntax for the best type-mapping support. Let me know if you need help with a specific version or query! Referencesdata_source/catalog/maxcompute_catalog.mddata_source/catalog/paimon_catalog.mdrelease_notes/release-3.3.mddata_source/External_table.mddata_source/catalog/iceberg/iceberg_catalog.md
j
@Rocky how do i read a uuid column that is stored as
FIXED_LEN_BYTE_ARRAY
from iceberg?
r
To read a UUID column stored as
FIXED_LEN_BYTE_ARRAY
in Iceberg, the behavior depends on the version of StarRocks you are using and whether you are using an Iceberg Catalog or a manual external table. 1. Mapping via Iceberg Catalog When using an Iceberg Catalog (the recommended way to query Iceberg), StarRocks handles the type mapping automatically: * StarRocks v3.3.11 and later: The Iceberg
UUID
type (which uses
FIXED_LEN_BYTE_ARRAY(16)
physically in Parquet) is mapped to the
BINARY
data type. * Versions before v3.3.11: The Iceberg
UUID
type was typically mapped to
VARCHAR
. 2. How to Read/Format the Column If your column is mapped to
BINARY
(v3.3.11+), querying it directly might return raw bytes or a hex-encoded string depending on your client settings. To view it in a human-readable format, you can use the
HEX()
function. To get a 32-character Hex String:
Copy code
sql
SELECT HEX(uuid_column) FROM your_iceberg_table;
-- Result: 550E8400E29B41D4A716446655440000
To get the standard hyphenated UUID format (
8-4-4-4-12
):
Since StarRocks does not currently have a built-in
BIN_TO_UUID
function, you can format the binary column manually using
SUBSTR
and `CONCAT`:
Copy code
sql
SELECT 
    LOWER(CONCAT_WS('-', 
        SUBSTR(HEX(uuid_column), 1, 8), 
        SUBSTR(HEX(uuid_column), 9, 4), 
        SUBSTR(HEX(uuid_column), 13, 4), 
        SUBSTR(HEX(uuid_column), 17, 4), 
        SUBSTR(HEX(uuid_column), 21, 12)
    )) AS uuid_string
FROM your_iceberg_table;
-- Result: 550e8400-e29b-41d4-a716-446655440000
3. Manual External Table (Deprecated method) If you are defining a manual Iceberg External Table (not using a Catalog), you should specify the column type as
VARCHAR
or
BINARY
in your
CREATE EXTERNAL TABLE
statement. According to StarRocks documentation, the Iceberg
UUID
type should be mapped to
VARCHAR
in these definitions for legacy support, but
BINARY
is preferred in modern versions for better performance and alignment with Parquet physical types. Summary * Check your version: Upgrading to 3.3.11+ ensures standard mapping to
BINARY
. * Use `HEX()`: This is the easiest way to inspect the values. * Catalog usage: Always prefer using an Iceberg Catalog so StarRocks can automatically resolve the
FIXED_LEN_BYTE_ARRAY
as a UUID. Referencessql-reference/sql-functions/binary-functions/to_binary.mdsql-reference/sql-functions/bitmap-functions/base64_to_bitmap.mdsql-reference/sql-functions/string-functions/hex_decode_string.mdsql-reference/sql-functions/bitmap-functions/bitmap_to_binary.mdsql-reference/sql-functions/string-functions/hex_decode_binary.md
j
@Rocky given this query to read a table from iceberg with a uuid column stored as
FIXED_LEN_BYTE_ARRAY
, fix this query to work from starrocks:
select * from datalake.events_table;
r
To read an Iceberg table containing a
UUID
column (stored as
FIXED_LEN_BYTE_ARRAY
) in StarRocks, you should be aware that from version 3.3.11 onwards, StarRocks officially maps the Iceberg
UUID
type to the
BINARY
data type. If your query
SELECT * FROM datalake.events_table;
is currently failing or returning unreadable binary data, here is how to fix it: 1. Version Requirement Ensure you are using StarRocks v3.3.11 or later. In earlier versions,
FIXED_LEN_BYTE_ARRAY
columns representing UUIDs were often unsupported in the Iceberg Catalog and would cause the query to fail. 2. Read as a Human-Readable String Since the column is mapped to
BINARY
, it will appear as a hexadecimal blob (e.g.,
0x123E...
) in most clients. To view it as a standard UUID string (
8-4-4-4-12
format), use the following SQL:
Copy code
sql
SELECT 
    lower(concat_ws('-', 
        substr(hex(uuid_column), 1, 8), 
        substr(hex(uuid_column), 9, 4), 
        substr(hex(uuid_column), 13, 4), 
        substr(hex(uuid_column), 17, 4), 
        substr(hex(uuid_column), 21, 12)
    )) AS uuid_string,
    * 
FROM datalake.events_table;
3. How to Filter by UUID If you need to filter the table using a UUID string, you must convert the string back to binary using
hex_decode_binary
and remove the dashes:
Copy code
sql
SELECT * 
FROM datalake.events_table 
WHERE uuid_column = hex_decode_binary(replace('550e8400-e29b-41d4-a716-446655440000', '-', ''));
Summary of Tips: * Check Mapping: Run
DESC datalake.events_table;
to verify that the column type is indeed
VARBINARY
or
BINARY
. * Session Variable: If you are on a version older than 3.3.11 and the query fails due to "Unsupported type," you can try setting
SET force_external_table_query_to_binary = true;
to force the engine to treat the complex/unsupported types as binary blobs, though upgrading is highly recommended for stable Iceberg support. Referencessql-reference/sql-functions/binary-functions/to_binary.mdsql-reference/sql-functions/string-functions/hex_decode_string.mdsql-reference/sql-functions/string-functions/hex_decode_binary.mdsql-reference/data-types/string-type/BINARY.mdsql-reference/sql-functions/bitmap-functions/bitmap_from_binary.mdsql-reference/sql-functions/bitmap-functions/bitmap_to_binary.md