Skip to content

Conversation

@osipovartem
Copy link
Contributor

Closes #161

Replace

select all_objects.*, is_iceberg
      from table(result_scan(last_query_id(-1))) all_objects
      left join INFORMATION_SCHEMA.tables as all_tables
        on all_tables.table_name = all_objects."name"
        and all_tables.table_schema = all_objects."schema_name"
        and all_tables.table_catalog = all_objects."database_name";

by

SELECT
   all_objects.* 
FROM
   (
      SELECT
         table_catalog AS 'database_name',
         table_schema AS 'schema_name',
         table_name AS 'name',
         CASE
            WHEN
               table_type = 'BASE TABLE' 
            THEN
               'TABLE' 
            ELSE
               table_type 
         END
         AS 'kind', NULL AS 'comment', 
         CASE
            WHEN
               table_type = 'BASE TABLE' 
            THEN
               true 
            ELSE
               false 
         END
         AS is_iceberg 
      FROM
         embucket.information_schema.tables
   )
   AS all_objects 
   LEFT JOIN
      embucket.INFORMATION_SCHEMA.tables AS all_tables 
      ON all_tables.table_name = all_objects.\"name\" 
      AND all_tables.table_schema = all_objects.\"schema_name\" 
      AND all_tables.table_catalog = all_objects.\"database_name\"

DanCodedThis
DanCodedThis previously approved these changes Jan 27, 2025
Copy link
Contributor

@DanCodedThis DanCodedThis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only thing that caught my eye is the loop

eadgbear
eadgbear previously approved these changes Jan 27, 2025
Base automatically changed from issues/160_create_database to main January 28, 2025 09:20
@osipovartem osipovartem dismissed stale reviews from eadgbear and DanCodedThis January 28, 2025 09:20

The base branch was changed.

@DanCodedThis DanCodedThis self-requested a review January 28, 2025 09:35
@osipovartem osipovartem merged commit f6e3fdc into main Jan 28, 2025
5 checks passed
@osipovartem osipovartem deleted the issues/161_table_result_scan branch January 28, 2025 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

engine: Implement workaround for table(result_scan(last_query_id(-1))) query

5 participants