我正在尝试使用 polybase 外部表功能将 Parquet 文件从 ADLS Gen2 加载到 Synapse。
下面是代码,但是在运行 create external table 命令时,查询永远不会完成。在取消查询执行时,我看到了这个错误 -
由于内部错误,外部文件访问失败:“访问 HDFS 时发生错误:调用 HdfsBridge_IsDirExist 时引发 Java 异常。Java 异常消息:HdfsBridge::isDirExist - 检查目录是否存在时遇到意外错误:UnknownHostException: ''.azuredatalakestore.dfs.core.windows.net'
SQL查询
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<password>';
GO
DROP CREDENTIAL ADLSCredential
CREATE DATABASE SCOPED CREDENTIAL ADLSCredential
WITH
IDENTITY = 'user',
SECRET = '<secret-key>'
;
CREATE EXTERNAL DATA SOURCE AzureDataLakeStorage
WITH (
TYPE = HADOOP,
LOCATION = 'abfss://<container>@<storage-account>.azuredatalakestore.dfs.core.windows.net',
CREDENTIAL = ADLSCredential
);
-- Create an external file format for PARQUET files.
CREATE EXTERNAL FILE FORMAT parquet
WITH (
FORMAT_TYPE = PARQUET,
DATA_COMPRESSION = 'org.apache.hadoop.io.compress.SnappyCodec'
);
CREATE EXTERNAL FILE FORMAT uncompressedcsv
WITH (
FORMAT_TYPE = DELIMITEDTEXT,
FORMAT_OPTIONS (
FIELD_TERMINATOR = ',',
STRING_DELIMITER = '',
DATE_FORMAT = '',
USE_TYPE_DEFAULT = False
)
);
CREATE EXTERNAL TABLE [dbo].[CashReceipts_external] (
[AMOUNT_APPLIED] [float] NOT NULL,
[TRX_NUMBER] [nvarchar](50) NULL,
[SHORT_NAME] [nvarchar](50) NOT NULL,
[NAME] [nvarchar](1) NULL,
[CURRENT_RECORD_FLAG] [nvarchar](50) NULL,
[CURRENCY_CODE] [nvarchar](50) NULL,
[FUNC_CURRENCY_CODE] [nvarchar](50) NOT NULL,
[CASH_RCPT_AMOUNT] [float] NULL,
[CASH_HISTORY_AMOUNT] [float] NULL,
[FUNC_AMT_HISTORY] [float] NULL,
[STATUS] [nvarchar](50) NULL,
[ANTICIPATED_CLEARING_DATE] [nvarchar](50) NULL,
[CASH_HISTORY_EXCHANGE_RATE] [nvarchar](50) NULL,
[GL_DATE] [datetime2](7) NULL,
[GL_PERIOD] [datetime2](7) NOT NULL,
[BATCH_GL_DATE] [nvarchar](1) NULL,
[EXCHANGE_RATE] [nvarchar](50) NULL,
[RECEIPT_NUMBER] [nvarchar](50) NULL,
[DEPOSIT_DATE] [datetime2](7) NULL,
[RECEIPT_DATE] [datetime2](7) NULL,
[ISSUE_DATE] [nvarchar](1) NULL,
[TYPE] [nvarchar](50) NULL,
[GL_POSTED_DATE] [datetime2](7) NULL,
[AMOUNT] [float] NULL
)
WITH
(
LOCATION='parquetfiles'
, DATA_SOURCE = AzureDataLakeStorage
, FILE_FORMAT = parquet
, REJECT_TYPE = VALUE
, REJECT_VALUE = 0
)
;