Spark와 같은 오픈소스 엔진을 사용하여 BigQuery 노트북에서 Apache Spark Iceberg 테이블을 쿼리할 수 있습니다. 이러한 테이블은 BigLake Metastore에 메타데이터가 저장된 일반 Iceberg 테이블입니다. BigQuery와 Spark에서 동일한 테이블을 쿼리할 수 있습니다.
시작하기 전에
BigQuery 노트북에서 Spark를 사용하는 동안 Iceberg 테이블을 만듭니다. 테이블 스키마는 BigLake 메타 스토어에 저장됩니다. 예를 들어 Dataproc, Dataproc Serverless 또는 저장 프로시져를 사용하여 테이블을 만들 수 있습니다.
고려사항
Iceberg 테이블만 지원됩니다.
쿼리를 실행할 때 네임스페이스와 데이터베이스 이름을 BigQuery 데이터 세트 이름으로 매핑해야 합니다. 다음 표에는 사용할 수 있는 적용 가능한 키 매핑이 나와 있습니다.
오픈소스
BigQuery
네임스페이스
BigQuery 데이터 세트
데이터베이스
BigQuery 데이터 세트
테이블(파티션이 있거나 없는 테이블)
BigQuery 테이블
테이블 보기 및 쿼리
Spark에서 BigQuery 리소스를 만든 후Google Cloud 콘솔에서 이를 보고 쿼리할 수 있습니다. 다음 예시는 대화형 Spark를 사용하여 메타스토어 테이블을 쿼리하는 일반적인 단계를 보여줍니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-26(UTC)"],[],[],null,["# Create and query metastore tables from Spark\n============================================\n\nYou can query Apache Spark Iceberg tables in a\nBigQuery notebook using open-source engines, such as\nSpark. These tables are regular\nIceberg tables with metadata stored in BigLake metastore. The\nsame table can be queried from both BigQuery and\nSpark.\n\nBefore you begin\n----------------\n\n- Create an Iceberg table while using Spark in a BigQuery notebook. The table schema is stored in BigLake metastore. For example, you can create the table with either [Dataproc](/bigquery/docs/blms-use-dataproc), [Dataproc Serverless](/bigquery/docs/blms-use-dataproc-serverless), or a [stored procedure](/bigquery/docs/blms-use-stored-procedures).\n\nView and query a table\n----------------------\n\nAfter creating your BigQuery resources in\nSpark, you can view and query them in the\nGoogle Cloud console. The following example shows you the general\nsteps to query a metastore table using interactive Spark:\n\n1. Use the custom Iceberg catalog:\n\n ```googlesql\n USE `\u003cvar translate=\"no\"\u003eCATALOG_NAME\u003c/var\u003e`;\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCATALOG_NAME\u003c/var\u003e: the name of the Spark catalog to that you're using with your SQL job.\n2. Create a namespace:\n\n ```googlesql\n CREATE NAMESPACE IF NOT EXISTS NAMESPACE_NAME;\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e: the namespace name that references your Spark table.\n3. Use the created namespace:\n\n ```googlesql\n USE NAMESPACE_NAME;\n ```\n4. Create an Iceberg table:\n\n ```googlesql\n CREATE TABLE TABLE_NAME (id int, data string) USING ICEBERG;\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e: a name for your Iceberg table.\n5. Insert a table row:\n\n ```googlesql\n INSERT INTO TABLE_NAME VALUES (1, \"first row\");\n ```\n6. Use the Google Cloud console to do one of the following:\n\n - [View the table metadata](/bigquery/docs/running-queries#queries)\n - [Query the table](/bigquery/docs/running-queries#queries)\n\n ```googlesql\n SELECT * FROM `\u003cvar translate=\"no\"\u003eTABLE_NAME\u003c/var\u003e`;\n ```\n\nWhat's next\n-----------\n\n- Set up [additional BigLake metastore features](/bigquery/docs/blms-features)."]]