question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support index acess for Row Type

See original GitHub issue

Today we only support access by field for Row Type. For row types without field types, we have to first cast it into a Row with field names:

presto > select CAST(v AS ROW(f1 BIGINT, f2 VARCHAR)).f1 
from (VALUES ROW(ROW(1, 'a')), ROW(ROW(2, 'b'))) AS t(v);

 _col0
-------
     1
     2
(2 rows)

It will be nice to support index access, i.e. v[1] will return the first field of the row.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
electrumcommented, Apr 8, 2017

Index access seems strange given that it must be constant. It’s really a tuple, not an array. What about generating well-known synthetic field names? For example, f1, f2, or c1, c2, etc. This makes it obvious they are constant field accesses and not array accesses.

1reaction
geraint0923commented, Mar 22, 2017

Good idea! But I think we should only allow constant index, otherwise it will be hard to infer the field type.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and use an index to improve performance
You can use an index to help Access find and sort records faster. ... In the Index Name column, in the first blank...
Read more >
15: 11.9. Index-Only Scans and Covering Indexes - PostgreSQL
The index type must support index-only scans. B-tree indexes always do. · The query must reference only columns stored in the index. For...
Read more >
Array Indexing - MATLAB & Simulink - MathWorks
Access elements of an array by specifying their indices or by checking whether elements meet a condition.
Read more >
CREATE INDEX
... access to rows. Oracle Database supports several types of index: Normal indexes. (By default, Oracle Database creates B-tree indexes.) Bitmap indexes ......
Read more >
INDEX - Google Docs Editors Help
reference - The range of cells from which the values are returned. row - [OPTIONAL - 0 by default] - The index of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found