Can we get these keys in the object column?
See original GitHub issueUse case:
Only want get these keys of object
Feature description:
Something like this
SELECT DISTINCT obj.keys FROM t
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Calculating 2 object keys/columns from array ... - Stack Overflow
You may destructure your object properties and sum up desired ones, using Array.prototype.reduce() :.
Read more >Object.getOwnPropertyNames() - JavaScript - MDN Web Docs
The Object.getOwnPropertyNames() method returns an array of all properties (including non-enumerable properties except for those which use Symbol) found ...
Read more >Map JavaScript Object Keys Using React | Pluralsight
In this guide, you will learn how to map over a JavaScript object's keys in a variety of ways so that you can...
Read more >Adding primary keys to user-defined objects - IBM
Primary keys can be added to user-defined objects to uniquely identify these objects in a database. A primary index is automatically created for...
Read more >Semi-structured Data Types - Snowflake Documentation
Strictly speaking, OBJECT is the only one of these data types that, by itself, ... (in different key-value pairs) can have different underlying...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If I understand your question correctly the short answer is no. If they’re used in the
WHERE
clause they won’t utilize the index structures. But they can utilize the query cache in some cases. (So that sub-sequent executions are fast)If your UDF will only be part of the select-list it usually has little impact on performance.
In your specific case we’d also load the value parts of the object, which of course has some costs. But we defer the value lookup as much as possible. So if the result set is already sufficiently reduced the impact will not matter.
But if you do for example a GROUP BY on the keys you’ve extracted than it will be slower than an optimized version would be.
Currently there is no built-in method for this, but you could create a javascript UDF to return the keys of an object as array and then use it together with
unnest
to turn the arrays into rows.