1047
1047
},
1048
1048
{
1049
1049
"name" : "col1" ,
1050
- "type" : "UNKNOWN " ,
1050
+ "type" : "TEXT " ,
1051
1051
"upstream" : [{"column" : "col1" , "table" : "dataset1.table1" }],
1052
1052
},
1053
1053
{
1054
1054
"name" : "col1" ,
1055
- "type" : "UNKNOWN " ,
1055
+ "type" : "TEXT " ,
1056
1056
"upstream" : [{"column" : "col1" , "table" : "dataset1.table1" }],
1057
1057
},
1058
1058
{
1059
1059
"name" : "col2" ,
1060
- "type" : "UNKNOWN " ,
1060
+ "type" : "TEXT " ,
1061
1061
"upstream" : [{"column" : "col2" , "table" : "dataset1.table1" }],
1062
1062
},
1063
1063
{
1064
1064
"name" : "col2" ,
1065
- "type" : "UNKNOWN " ,
1065
+ "type" : "TEXT " ,
1066
1066
"upstream" : [{"column" : "col2" , "table" : "dataset1.table1" }],
1067
1067
},
1068
1068
{
1069
1069
"name" : "col3" ,
1070
- "type" : "UNKNOWN " ,
1070
+ "type" : "TEXT " ,
1071
1071
"upstream" : [{"column" : "col3" , "table" : "dataset1.table1" }],
1072
1072
},
1073
1073
{
1074
1074
"name" : "col3" ,
1075
- "type" : "UNKNOWN " ,
1075
+ "type" : "TEXT " ,
1076
1076
"upstream" : [{"column" : "col3" , "table" : "dataset1.table1" }],
1077
1077
},
1078
1078
{
1079
1079
"name" : "col3" ,
1080
- "type" : "UNKNOWN " ,
1080
+ "type" : "TEXT " ,
1081
1081
"upstream" : [{"column" : "col3" , "table" : "dataset1.table1" }],
1082
1082
},
1083
1083
{
1084
1084
"name" : "col4" ,
1085
- "type" : "UNKNOWN " ,
1085
+ "type" : "TEXT " ,
1086
1086
"upstream" : [{"column" : "col4" , "table" : "dataset1.table1" }],
1087
1087
},
1088
1088
{
1089
1089
"name" : "col4" ,
1090
- "type" : "UNKNOWN " ,
1090
+ "type" : "TEXT " ,
1091
1091
"upstream" : [{"column" : "col4" , "table" : "dataset1.table1" }],
1092
1092
},
1093
1093
{
1094
1094
"name" : "col4" ,
1095
- "type" : "UNKNOWN " ,
1095
+ "type" : "TEXT " ,
1096
1096
"upstream" : [{"column" : "col4" , "table" : "dataset1.table1" }],
1097
1097
},
1098
1098
{
1099
1099
"name" : "col5" ,
1100
- "type" : "UNKNOWN " ,
1100
+ "type" : "TEXT " ,
1101
1101
"upstream" : [{"column" : "col5" , "table" : "dataset1.table1" }],
1102
1102
},
1103
1103
{
1104
1104
"name" : "col6" ,
1105
- "type" : "UNKNOWN " ,
1105
+ "type" : "TEXT " ,
1106
1106
"upstream" : [{"column" : "col6" , "table" : "dataset1.table1" }],
1107
1107
},
1108
1108
{
1112
1112
},
1113
1113
{
1114
1114
"name" : "organization" ,
1115
- "type" : "UNKNOWN " ,
1115
+ "type" : "TEXT " ,
1116
1116
"upstream" : [{"column" : "col1" , "table" : "dataset3.table3" }],
1117
1117
},
1118
1118
{
1119
1119
"name" : "organizationid" ,
1120
- "type" : "UNKNOWN " ,
1120
+ "type" : "TEXT " ,
1121
1121
"upstream" : [{"column" : "col2" , "table" : "dataset3.table3" }],
1122
1122
},
1123
1123
{
1124
1124
"name" : "programname" ,
1125
- "type" : "UNKNOWN " ,
1125
+ "type" : "TEXT " ,
1126
1126
"upstream" : [{"column" : "col1" , "table" : "dataset2.table2" }],
1127
1127
},
1128
1128
{
1129
1129
"name" : "teamid" ,
1130
- "type" : "UNKNOWN " ,
1130
+ "type" : "TEXT " ,
1131
1131
"upstream" : [{"column" : "col2" , "table" : "dataset6.table6" }],
1132
1132
},
1133
1133
{
1134
1134
"name" : "teamname" ,
1135
- "type" : "UNKNOWN " ,
1135
+ "type" : "TEXT " ,
1136
1136
"upstream" : [{"column" : "col1" , "table" : "dataset6.table6" }],
1137
1137
},
1138
1138
],
1248
1248
"expected" : [
1249
1249
{
1250
1250
"name" : "col1" ,
1251
- "type" : "UNKNOWN " ,
1251
+ "type" : "TEXT " ,
1252
1252
"upstream" : [{"column" : "col1" , "table" : "project1.dataset1.table1" }],
1253
1253
},
1254
1254
{
1255
1255
"name" : "col1" ,
1256
- "type" : "UNKNOWN " ,
1256
+ "type" : "TEXT " ,
1257
1257
"upstream" : [{"column" : "col1" , "table" : "project1.dataset1.table1" }],
1258
1258
},
1259
1259
{
1260
1260
"name" : "col2" ,
1261
- "type" : "UNKNOWN " ,
1261
+ "type" : "TEXT " ,
1262
1262
"upstream" : [{"column" : "col2" , "table" : "project1.dataset1.table1" }],
1263
1263
},
1264
1264
{
1265
1265
"name" : "col2" ,
1266
- "type" : "UNKNOWN " ,
1266
+ "type" : "TEXT " ,
1267
1267
"upstream" : [{"column" : "col2" , "table" : "project1.dataset1.table1" }],
1268
1268
},
1269
1269
{
1270
1270
"name" : "col3" ,
1271
- "type" : "UNKNOWN " ,
1271
+ "type" : "TEXT " ,
1272
1272
"upstream" : [{"column" : "col3" , "table" : "project1.dataset1.table1" }],
1273
1273
},
1274
1274
{
1275
1275
"name" : "col3" ,
1276
- "type" : "UNKNOWN " ,
1276
+ "type" : "TEXT " ,
1277
1277
"upstream" : [{"column" : "col3" , "table" : "project1.dataset1.table1" }],
1278
1278
},
1279
1279
{
1280
1280
"name" : "col3" ,
1281
- "type" : "UNKNOWN " ,
1281
+ "type" : "TEXT " ,
1282
1282
"upstream" : [{"column" : "col3" , "table" : "project1.dataset1.table1" }],
1283
1283
},
1284
1284
{
1285
1285
"name" : "col4" ,
1286
- "type" : "UNKNOWN " ,
1286
+ "type" : "TEXT " ,
1287
1287
"upstream" : [{"column" : "col4" , "table" : "project1.dataset1.table1" }],
1288
1288
},
1289
1289
{
1290
1290
"name" : "col4" ,
1291
- "type" : "UNKNOWN " ,
1291
+ "type" : "TEXT " ,
1292
1292
"upstream" : [{"column" : "col4" , "table" : "project1.dataset1.table1" }],
1293
1293
},
1294
1294
{
1295
1295
"name" : "col4" ,
1296
- "type" : "UNKNOWN " ,
1296
+ "type" : "TEXT " ,
1297
1297
"upstream" : [{"column" : "col4" , "table" : "project1.dataset1.table1" }],
1298
1298
},
1299
1299
{
1300
1300
"name" : "col5" ,
1301
- "type" : "UNKNOWN " ,
1301
+ "type" : "TEXT " ,
1302
1302
"upstream" : [{"column" : "col5" , "table" : "project1.dataset1.table1" }],
1303
1303
},
1304
1304
{
1305
1305
"name" : "col6" ,
1306
- "type" : "UNKNOWN " ,
1306
+ "type" : "TEXT " ,
1307
1307
"upstream" : [{"column" : "col6" , "table" : "project1.dataset1.table1" }],
1308
1308
},
1309
1309
{
1313
1313
},
1314
1314
{
1315
1315
"name" : "department" ,
1316
- "type" : "UNKNOWN " ,
1316
+ "type" : "TEXT " ,
1317
1317
"upstream" : [{"column" : "col1" , "table" : "project3.dataset3.table3" }],
1318
1318
},
1319
1319
{
1320
1320
"name" : "departmentid" ,
1321
- "type" : "UNKNOWN " ,
1321
+ "type" : "TEXT " ,
1322
1322
"upstream" : [{"column" : "col2" , "table" : "project3.dataset3.table3" }],
1323
1323
},
1324
1324
{
1328
1328
},
1329
1329
{
1330
1330
"name" : "programname" ,
1331
- "type" : "UNKNOWN " ,
1331
+ "type" : "TEXT " ,
1332
1332
"upstream" : [{"column" : "col1" , "table" : "project2.dataset2.table2" }],
1333
1333
},
1334
1334
{"name" : "project_credits" , "type" : "INT" , "upstream" : []},
1335
1335
{
1336
1336
"name" : "projectid" ,
1337
- "type" : "UNKNOWN " ,
1337
+ "type" : "TEXT " ,
1338
1338
"upstream" : [{"column" : "col2" , "table" : "project6.dataset6.table6" }],
1339
1339
},
1340
1340
{
1341
1341
"name" : "projectname" ,
1342
- "type" : "UNKNOWN " ,
1342
+ "type" : "TEXT " ,
1343
1343
"upstream" : [{"column" : "col1" , "table" : "project6.dataset6.table6" }],
1344
1344
},
1345
1345
],
1381
1381
},
1382
1382
],
1383
1383
},
1384
+ {
1385
+ "name" : "simple nested table references" ,
1386
+ "dialect" : "bigquery" ,
1387
+ "query" : """SELECT mycol FROM raw.table1""" ,
1388
+ "schema" : {
1389
+ "raw.table1" : {
1390
+ "mycol" : "STRING" ,
1391
+ }
1392
+ },
1393
+ "expected" : [
1394
+ {
1395
+ "name" : "mycol" ,
1396
+ "type" : "TEXT" ,
1397
+ "upstream" : [{"column" : "mycol" , "table" : "raw.table1" }],
1398
+ },
1399
+ ],
1400
+ "expected_non_selected" : [],
1401
+ },
1384
1402
]
1385
1403
1386
1404
@@ -1416,4 +1434,4 @@ def test_extract_non_select_column(query, schema, expected, dialect):
1416
1434
parsed = parse_one (query , dialect = dialect )
1417
1435
optimized = optimize (parsed , schema , dialect = dialect )
1418
1436
result = extract_non_selected_columns (optimized )
1419
- assert result == expected
1437
+ assert result == expected
0 commit comments