Hue - Impala Query Editor shows 'highlighted' query offset to the cursor position - hue

When using Hue, creating/editing Impala queries, the highlighted query will initially start off based on the row that the cursor is on.
So if I have a single query, and select a row anywhere within that query, ctrl+enter will run that query.
This works reasonably well with more than one query in the editor, separated by semi colons - i.e. you can click onto any row of a query and that query will be highlighted in the 'gutter', ctrl+enter will run that query.
At some point, and I think it's associated with "with" statements, the row that the editor thinks the cursor is selecting, is offset to a previous row, as more queries may be added, this offset becomes greater.
I can see this offset in action by adding a few carriage returns after my last query, and eventually the gutter highlighting will perceive the cursor to be on a row associated with the last query.
The same is also true for clicking on a row within multiple queries, depending on how 'far' the offset is, you may need to set the cursor on the third or fourth row of a query before that query is highlighted.
Is this a bug or seemingly unique to our instance of Hue? Are there any workarounds for this behaviour?
Thanks!

Related

How to group columns by header in Google Sheets?

I have multiple tables populated in the same sheet, but need them in a single table. How do I dynamically create a single table? The raw data will change, so it needs to accept additional rows as they populate.
Here is a demo document with the raw data and desired effect.
https://docs.google.com/spreadsheets/d/1V8ytyN-qSUW0Wrba7FxmQ242YXSNQ18y6nneEz6bS5g/edit?usp=sharing
Your raw data should remain alone in its sheet. So first, remove everything you currently have in Sheet1!A12:D, since it will interfere with your ability to write formulas that allow the raw data in A:D to expand downward.
Once you've removed that, add a new sheet. In that sheet, use this formula:
=QUERY({Sheet1!A3:D3;Sheet1!A4:D;Sheet1!F4:I},"Select * Where Col1 Is Not Null")
The curly brackets allow the formation of a virtual array. Within those curly brackets, a semicolon means "place what comes next below" while a comma would mean "place what comes next beside." Understand that such virtual arrays must keep parallel structure at all times; for instance, you can't place a range that's four columns wide over one that's only three columns wide.
As written, those stacked ranges go all the way to the bottom of the sheet, since there is no row number on the second part of the range (e.g., A4:D means "the range that starts with A4 in the upper left and runs to the bottom of Column D, wherever that is"). By doing this, you are always able to include more data without adjusting the formula.
All that is left to do is weed out blank rows. The outer QUERY as written allows us to trim that virtual array to to only those rows where the first column is not empty.

How to select previous or next rows in a query?

I would like to select rows of a column and show it side by side by the same column that is shifted by one either up or down. Something like this:
=QUERY(A2:E6,"select A, LEAD(A)")
OR
=QUERY(A2:E6,"select A, LAG(A)")
I tried OFFSET, but it offsets both columns, not one of them.
LEAD and LAG don't exists in Google's query language. Is there any workaround?
You could use plain OFFSET with array stacking:
={A2:E6,OFFSET(A2:E6,1,0)}

Using mode for a range and ignoring blanks

Almost got this working but can't quite get the last piece. I am trying to find the mode of a range of text cells, but crucially, ignoring the blank cells (the range is a series of drop downs with an initial value of a blank).
I have used this formula:
=iferror(INDEX(C5:K5,MODE(IF(C5:K5<>"",MATCH(C5:K5,C5:K5,0)))),"-")
It is almost there but only seems to become active when 2 or more cells are in play. I understand there would be an error if there are no common ones which I will fix with IFERROR but it seems that if I only have one result in my range, it doesn't register as a most common (until I select another cell too).
Use FILTER() to remove the unwanted blanks:
=IFERROR(IF(COUNTA(C5:K5)=1,filter(C5:K5,C5:K5<>""),INDEX(filter(C5:K5,C5:K5<>""),MODE(MATCH(filter(C5:K5,C5:K5<>""),filter(C5:K5,C5:K5<>""),0)))),"-")

How can I copy+paste rich text to just one column on Google Sheets?

I've googled this issue and have found plenty of information on how to "split text into different columns", but I want to copy+paste the text into just one column on the google sheet.
Herewith is a picture that shows what I'm getting (on the left), and what I actually need (on the right). I've tried CTRL+SHIFT+V but it doesn't work either. I did it in the past, but can't remember how.
Its a two part process.
1) Find the last column
Start with the cursor in the first column, press CTRL+Down. The cursor should jump to the next cell in the column. Press CTRL+Up, to move back to the top row. Move the cursor one column to the right and repeat.
It won't take long and you'll find that the cursor goes right to the bottom of the sheet; which means that there's no data in that column, and the Previous column is the last column.
2) Concatenate each row
Go to the first row of data, and create a Concatenate formula. Include every column from the first column (B) to the last column, regardless of whether you think there is data in those columns on this row.
Then copy the formula down to the very last row of data.
Then highlight the range, and Copy/Paste Values.
Depending on which are your first and last columns, your formula might look like this.
=CONCATENATE(C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1)

Improving a Spreadsheet Formula to be more dynamic

I have a a couple sheets that I want to filter the values of and sum them together. I have a working function:
=SUM(INDEX(Grades!M32:V32,0,B2)+INDEX(Grades!M32:V32,0,C2)+INDEX(Grades!M32:V32,0,D2)+INDEX(Grades!M32:V32,0,E2)+INDEX(Grades!M32:V32,0,F2)+INDEX(Grades!M32:V32,0,G2))
and this is working fine. The problem is it isn't really dynamic and I was wondering if there was a more efficient way to approach this instead of using so many Indexes.
Index is grabbing a horizontal range of numbers from another sheet and getting the needed index position from a small table in another sheet.
Update
I was able to get the formula working how I wanted by inserting an IF statement that would not do the VLOOKUP if one of the cells was empty.
=ArrayFormula(SUM(IF(B2:I2 <> "",VLOOKUP(1,{1,Grades!$M$32:$V$32},B2:I2+1))))
It looks a bit strange, but this is one way:
=ArrayFormula(SUM(VLOOKUP(1,{1,Grades!M32:V32},B2:G2+1,0)))
In the VLOOKUP, 1 is the value you are searching for, {1,Grades!M32:V32} is the array in which you are searching, B2:G2+1 is the column index (or rather, indices) you wish to return, and 0 dictates that you require an exact match.
{1,Grades!M32:V32} constructs a horizontal, one-row array that has 1 in the left-most element, with the values in Grades!M32:V32 to the right of it.
VLOOKUP will search down the left-most column of that array. It will always "find" the 1 that it is searching for in the left-most column, because we have purposely manufactured that.
Where the action really happens is in the third argument, where we return the columns in that manufactured array corresponding with the values in B2:G2 (I should add, I assumed that all cells in B2:G2 are populated - it will return the wrong result if any are blank). The +1 is to account for the extra element (the 1) we tacked on to the left of the lookup array.

Resources