ytsaurus / ytsaurus/ytsaurus

YQL query fails with weak schema

Open
#632 0 comments 0 reactions 1 assignee Claimed by @Krisha11 View on GitHub
query tracker
Dominant language
C++
Stars
2.2k
Forks
219
PR merge metrics
No merged PRs in 30d

Description

Hello!

I encountered an issue when querying a table with a weak schema. Here's a reproduction of the problem:

### Steps to Reproduce:

Create a table with mixed types using the following command:

```bash
echo '{"foo":3.14,"bar":42}\n{"foo":0,"bar":null}' | yt write-table '//tmp/test_table' --format json
```

Run the following YQL query:
```sql
PRAGMA yt.InferSchema = '1';

SELECT * FROM `//tmp/test_table`;
```

### Observed Behavior:

The query fails with the following error:

```
'User job failed' { 'Table input pipe failed' { 'Unexpected type of "foo" column: Skiff format expected "double", actual table type "int64"' } }
```

### Workaround:

If `0.0` is used instead of `0`, the query works as expected. However, if the table with mixed types (double and integer in this case) already exists, it is not feasible to remap the table each time.

### Expected Behavior:

Is it possible to handle tables with mixed types without requiring remapping?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.