Examples: Comparing Data Types - Analytics Database - Teradata Vantage

DATASET Data Type

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
bka1628112240653.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
ekk1458586304878
lifecycle
latest
Product Category
Teradata Vantageā„¢

These examples compare CHAR/VARCHAR/CLOB/JSON data types that represent an Avro schema.

/*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"]
 }');

Result:

> 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"}
	]
 }}');

Result:

> 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"}
	]
 }}');

Result:

> 1