例: データ型の比較 - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - DATASETデータ型

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
2021年7月
ft:locale
ja-JP
ft:lastEdition
2021-09-23
dita:mapPath
ja-JP/amv1590702100517.ditamap
dita:ditavalPath
ja-JP/wrg1590696035526.ditaval
dita:id
B035-1198
Product Category
Software
Teradata Vantage

この例では、Avroスキーマを表わすCHAR、VARCHAR、CLOB、JSONのデータ型を比較します。

/*fail due to name of symbol mismatch*/
SELECT SchemaEqual(
'{ "type": "enum",
   "name": "Suit",
   "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
 }',
'{ "type": "enum",
   "name": "Suits",
   "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
 }');
> 0

/*fail due to structural mismatch*/
SELECT SchemaEqual(
'{ "type": "enum",
   "name": "Suit",
   "symbols" : ["SPADES", "HEARTS", "DIAMONDS", "CLUBS"]
 }', 
'{ "type" : "array",
   "items" : {
	"type": "record",
	"name": "test",
	"doc": "this is unique01",
	"fields" : [
		{"name": "a", "type": "long"},
		{"name": "b", "type": "string"}
	]
 }}');
> 0

/*success - everything is equal and doc is ignored*/
SELECT SchemaEqual(
'{ "type" : "array",
   "items" : {
	"type": "record",
	"name": "test",
	"doc": "this is unique01",
	"fields" : [
		{"name": "a", "type": "long"},
		{"name": "b", "type": "string"}
	]
 }}',
'{ "type" : "array",
   "items" : {
	"type": "record",
	"name": "test",
	"doc": "this is unique02",
	"fields" : [
		{"name": "a", "type": "long"},
		{"name": "b", "type": "string"}
	]
 }}');
> 1