@@ -827,16 +827,19 @@ def test_order_sequence():
827827
828828def test_virtual_column_ext_table ():
829829 ddl = """
830- create or replace external table if not exists TABLE_DATA_SRC.EXT_PAYLOAD_MANIFEST_WEB (
830+ create external table if not exists TABLE_DATA_SRC.EXT_PAYLOAD_MANIFEST_WEB (
831831 "type" VARCHAR(255) AS (SPLIT_PART(SPLIT_PART(METADATA$FILENAME, '/', 1), '=', 2 )),
832832 "year" VARCHAR(255) AS (SPLIT_PART(SPLIT_PART(METADATA$FILENAME, '/', 2), '=', 2)),
833833 "month" VARCHAR(255) AS (SPLIT_PART(SPLIT_PART(METADATA$FILENAME, '/', 3), '=', 2)),
834834 "day" VARCHAR(255) AS (SPLIT_PART(SPLIT_PART(METADATA$FILENAME, '/', 4), '=', 2)),
835+ "cast_YEAR" VARCHAR(200) AS (GET(VALUE,'c1')::string),
835836 "path" VARCHAR(255) AS (METADATA$FILENAME)
836837 )
837838 partition by ("type", "year", "month", "day", "path")
838- location=@ADL_Azure_Storage_Account_Container_Name/
839+ location=@ADL_Azure_Storage_Account_Container_Name/year=2023/month=08/
839840 auto_refresh=false
841+ pattern='*.csv'
842+ file_format = (TYPE = JSON NULL_IF = () STRIP_OUTER_ARRAY = TRUE )
840843 ;
841844 """
842845 result_ext_table = DDLParser (ddl , normalize_names = True , debug = True ).run (
@@ -901,6 +904,19 @@ def test_virtual_column_ext_table():
901904 "as" : "SPLIT_PART(SPLIT_PART(METADATA$FILENAME,'/',4),'=',2)"
902905 },
903906 },
907+ {
908+ "name" : "cast_YEAR" ,
909+ "type" : "VARCHAR" ,
910+ "size" : 200 ,
911+ "references" : None ,
912+ "unique" : False ,
913+ "nullable" : True ,
914+ "default" : None ,
915+ "check" : None ,
916+ "generated" : {
917+ "as" : "GET(VALUE,'c1') ::string"
918+ },
919+ },
904920 {
905921 "name" : "path" ,
906922 "type" : "VARCHAR" ,
@@ -924,12 +940,17 @@ def test_virtual_column_ext_table():
924940 "schema" : "TABLE_DATA_SRC" ,
925941 "table_name" : "EXT_PAYLOAD_MANIFEST_WEB" ,
926942 "tablespace" : None ,
927- "replace" : True ,
928943 "external" : True ,
929944 "if_not_exists" : True ,
930- "location" : "@ADL_Azure_Storage_Account_Container_Name/" ,
945+ "location" : "@ADL_Azure_Storage_Account_Container_Name/year=2023/month=08/ " ,
931946 "table_properties" : {
932947 "auto_refresh" : False ,
948+ "pattern" : "'*.csv'" ,
949+ "file_format" : {
950+ "TYPE" : "JSON" ,
951+ "NULL_IF" : "()" ,
952+ "STRIP_OUTER_ARRAY" : "TRUE" ,
953+ }
933954 },
934955 }
935956 ]
@@ -943,7 +964,7 @@ def test_virtual_column_table():
943964 id bigint,
944965 derived bigint as (id * 10)
945966 )
946- location = @Database.Schema. ADL_Azure_Storage_Account_Container_Name/entity
967+ location = @ADL_Azure_Storage_Account_Container_Name/entity
947968 auto_refresh = false
948969 file_format = (TYPE=JSON NULL_IF=('field') DATE_FORMAT=AUTO TRIM_SPACE=TRUE)
949970 stage_file_format = (TYPE=JSON NULL_IF=())
@@ -991,7 +1012,7 @@ def test_virtual_column_table():
9911012 "tablespace" : None ,
9921013 "replace" : True ,
9931014 "if_not_exists" : True ,
994- "location" : "ADL_Azure_Storage_Account_Container_Name/entity" ,
1015+ "location" : "@ ADL_Azure_Storage_Account_Container_Name/entity" ,
9951016 "table_properties" : {
9961017 "auto_refresh" : False ,
9971018 "file_format" : {
0 commit comments