Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: At function: AssumeColumnOrder, At function: Take, At function: Sort, At function: PgReplaceUnknown, At function: OrderedMap, At function: AsStruct #9676

Open
SloNN opened this issue Sep 24, 2024 · 0 comments
Labels

Comments

@SloNN
Copy link
Collaborator

SloNN commented Sep 24, 2024

I'm making a query

SELECT DATE_TRUNC('year', dt_tm) AS __timestamp,
       athlete AS athlete,
       count(DISTINCT athlete) AS "COUNT_DISTINCT(athlete)"
FROM
  (select edition,
          edition_id,
          country_noc,
          sport,
          event,
          result_id,
          athlete,
          athlete_id,
          pos,
          medal,
          isTeamSport,
          year,
          CASE
              WHEN MOD(year, 4) = 0 THEN False
              ELSE True
          END AS isWinter,
          TO_DATE(year::text || '-01-01', 'YYYY-MM-DD') AS dt,
          TO_TIMESTAMP(year::text || '-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') AS dt_tm
   from
     (select edition,
             edition_id,
             country_noc,
             sport,
             event,
             result_id,
             athlete,
             athlete_id,
             pos,
             medal,
             isTeamSport,
             cast(LEFT(edition, 4) as int) as year
      from Olimpic) as Olimpic) AS virtual_table
GROUP BY athlete,
         DATE_TRUNC('year', dt_tm)
ORDER BY "COUNT_DISTINCT(athlete)" DESC
LIMIT 10000;

But receives the error

Status: GENERIC_ERROR
Issues: 
<main>: Error: Type annotation, code: 1030
    <main>:1:1: Error: At function: AssumeColumnOrder, At function: Take, At function: Sort, At function: PgReplaceUnknown, At function: OrderedMap, At function: AsStruct
        <main>:1:8: Error: At function: PgResolvedCall
            <main>:1:27: Error: At function: Member
                <main>:1:27: Error: Member not found: _alias_virtual_table.dt_tm
@SloNN SloNN added the area/pg label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant