Filter External Parquet Data From a Foreign Table | NOS | Teradata Vantage - 17.10 - Filtering External Parquet Data From a Foreign Table - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Native Object Store Getting Started Guide

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1214-171K
Language
English (United States)
Parquet tables don't have a payload column. The user creates a foreign table and maps the Parquet logical data type to the corresponding Teradata data type.

The example shows filtering based on the Parquet data received from the object store. All the Parquet data from the object store at the foreign table location will be brought into the database and then filtered.

The examples and results show a sample river flow data set. To use your own data, replace the table and column names, and authorization object.

  1. To run NOS-related commands, log on to the database as a user with the required privileges.
  2. Create a foreign table to access external Parquet data:
    CREATE FOREIGN TABLE riverflow_parquet_path
    , EXTERNAL SECURITY authorization_object
    USING ( 
    LOCATION ('YOUR-OBJECT-STORE-URI')
    PATHPATTERN ('$data/$siteno/$year/$month/$day')
    );

    See Variable Substitutions for Examples for the credentials and location values for the sample river flow data set.

  3. Filter on a specific column in the Parquet data from external storage using the foreign table.
    SELECT TOP 2 GageHeight, Flow
    FROM riverflow_parquet_path
    WHERE site_no = '09394500';

    Result:

    TheGageHeight    TheFlow
    -------------  ---------
             6.40       6.29
             5.13       0.00