RE: HiveSQL: Author Rewards & Curation Rewards
You are viewing a single comment's thread:
I can't separate post votes and comment votes. The columns of the table txvotes in hive-sql are arranged this way.
ID, | tx_id, | voter, | author, | permlink, | weight, | timestamp |
---|
Can you tell me how to separate post votes and comment votes? Do you think that is not possible?
0
0
0.000
You may have to combine TxVotes table with Comments table using JOIN. Here is an example.
If
parent_author
is empty or nothing, it would mean it is a post, otherwise it is a comment.Thank you @geekgirl, your work is valuable
You should not use
parent_author=''
to differentiate posts from comments butdepth=0
!The
depth
column has its own index and numeric value comparisons are way faster than string comparisons, especially on a big number of rows.It's also good practice to explicitly specify which JOIN type you use and to have all join conditions in the JOIN clause rather than splitting them into the WHERE clause.
Finally, you are making your JOIN in the wrong order. The main table should be TxVotes (table in which you are looking for info) and Comments should come next as it's a table you use to filter and get alternate data.
Thank you Arcange! This is super helpful.
@topbooster, see above comment by Arcange for a correct answer to your question.
This is great @arcange , I would be more benefited if you elaborate on what the depth column indicates and how to separate the only comment votes data.
depth is the depth level in the comments tree, where depth=0 indicates a root post and depth > 0 are comments
Thank you and @geekgirl for the help.