```sql
create table dat (blockNum Decimal(10,0), eventTimestamp DateTime64(9) ) 
Engine=MergeTree() primary key eventTimestamp;
insert into dat values (1, '2022-01-24 02:30:00.008122000');

CREATE DICTIONARY datDictionary
(
    `blockNum` Decimal(10, 0),
    `eventTimestamp` DateTime64(9)
)
PRIMARY KEY blockNum
SOURCE(CLICKHOUSE(TABLE 'dat'))
LIFETIME(MIN 0 MAX 1000)
LAYOUT(FLAT());

select * from datDictionary;
┌─blockNum─┬────────────────eventTimestamp─┐
│        1 │ 2022-01-24 02:30:00.008122000 │
└──────────┴───────────────────────────────┘

select count(*) from dat where eventTimestamp >= (select eventTimestamp from datDictionary);

Exception on client:
Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF)

Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
```

```sql
drop dictionary datDictionary;

CREATE DICTIONARY datDictionary
(
    `blockNum` Decimal(10, 0),
    `eventTimestamp` DateTime64(9)
)
PRIMARY KEY blockNum
SOURCE(CLICKHOUSE(TABLE 'dat'))
LIFETIME(MIN 0 MAX 1000)
LAYOUT(complex_key_hashed());

select count(*) from dat where eventTimestamp >= (select eventTimestamp from datDictionary);

Error on processing query: Code: 32. DB::Exception: Attempt to read after eof: while receiving packet from localhost:9000. (ATTEMPT_TO_READ_AFTER_EOF) (version 22.7.1.1054)

Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000). (NETWORK_ERROR)
```

```sql
select * from datDictionary;
┌─blockNum─┬────────────────eventTimestamp─┐
│        1 │ 2022-01-24 02:30:00.008122000 │
└──────────┴───────────────────────────────┘

select dictGet('datDictionary', 'eventTimestamp', tuple(cast('1','Decimal(10,0)')));
Code: 407. DB::Exception: Received from localhost:9000. DB::Exception: Bad scale of decimal field. (DECIMAL_OVERFLOW)
```

}
    
    {
        UInt32 have_decimal32 = type_ids.count(TypeIndex::Decimal32);
        UInt32 have_decimal64 = type_ids.count(TypeIndex::Decimal64);
        UInt32 have_decimal128 = type_ids.count(TypeIndex::Decimal128);
        if (have_decimal32 || have_decimal64 || have_decimal128)
        {
            UInt32 num_supported = have_decimal32 + have_decimal64 + have_decimal128;
            std::vector<TypeIndex> int_ids = {TypeIndex::Int8, TypeIndex::UInt8, TypeIndex::Int16, TypeIndex::UInt16,
                                            TypeIndex::Int32, TypeIndex::UInt32, TypeIndex::Int64, TypeIndex::UInt64};
            std::vector<UInt32> num_ints(int_ids.size(), 0);
            TypeIndex max_int = TypeIndex::Nothing;
            for (size_t i = 0; i < int_ids.size(); ++i)
            {
                UInt32 num = type_ids.count(int_ids[i]);
                num_ints[i] = num;
                num_supported += num;
                if (num)
                    max_int = int_ids[i];
            }
            if (num_supported != type_ids.size())
                return throwOrReturn<on_error>(types, "because some of them have no lossless conversion to Decimal", ErrorCodes::NO_COMMON_TYPE);
            UInt32 max_scale = 0;
            for (const auto & type : types)
            {
                UInt32 scale = getDecimalScale(*type, 0);
                if (scale > max_scale)
                    max_scale = scale;
            }