Skip to content

Commit

Permalink
Merge pull request #7214 from dolthub/steph/schema-import-types
Browse files Browse the repository at this point in the history
Additional `dolt schema import` types
  • Loading branch information
stephkyou authored Dec 27, 2023
2 parents 9d2b0bf + ff0107f commit a5f6a31
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go/cmd/dolt/commands/schcmds/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (cmd ImportCmd) ArgParser() *argparser.ArgParser {
return ap
}

// Exec implements the import schema command that will take a file and infer it's schema, and then create a table matching that schema.
// Exec implements the import schema command that will take a file and infer its schema, and then create a table matching that schema.
// Exec executes the command
func (cmd ImportCmd) Exec(ctx context.Context, commandStr string, args []string, dEnv *env.DoltEnv, cliCtx cli.CliContext) int {
ap := cmd.ArgParser()
Expand Down
19 changes: 17 additions & 2 deletions go/libraries/doltcore/env/actions/infer_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package actions

import (
"context"
"encoding/json"
"errors"
"io"
"math"
Expand Down Expand Up @@ -181,7 +182,19 @@ func leastPermissiveType(strVal string, floatThreshold float64) typeinfo.TypeInf
return typeinfo.BoolType
}

return typeinfo.StringDefaultType
if strings.Contains(strVal, "{") || strings.Contains(strVal, "[") {
var j interface{}
err := json.Unmarshal([]byte(strVal), &j)
if err == nil {
return typeinfo.JSONType
}
}

if int64(len(strVal)) > typeinfo.MaxVarcharLength {
return typeinfo.TextType
} else {
return typeinfo.StringDefaultType
}
}

func leastPermissiveNumericType(strVal string, floatThreshold float64) (ti typeinfo.TypeInfo) {
Expand Down Expand Up @@ -323,7 +336,9 @@ func findCommonType(ts typeInfoSet) typeinfo.TypeInfo {

// len(ts) > 1

if setHasType(ts, typeinfo.StringDefaultType) {
if setHasType(ts, typeinfo.TextType) {
return typeinfo.TextType
} else if setHasType(ts, typeinfo.StringDefaultType) {
return typeinfo.StringDefaultType
}

Expand Down
3 changes: 2 additions & 1 deletion go/libraries/doltcore/schema/typeinfo/varstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ type varStringType struct {
var _ TypeInfo = (*varStringType)(nil)

var (
StringDefaultType = &varStringType{gmstypes.MustCreateStringWithDefaults(sqltypes.VarChar, 16383)}
MaxVarcharLength = int64(16383)
StringDefaultType = &varStringType{gmstypes.MustCreateStringWithDefaults(sqltypes.VarChar, MaxVarcharLength)}
)

func CreateVarStringTypeFromSqlType(stringType sql.StringType) TypeInfo {
Expand Down
37 changes: 37 additions & 0 deletions integration-tests/bats/schema-import.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ setup() {
pk,c1,c2,c3,c4,c5
0,1,2,3,4,5
1,1,2,3,4,5
DELIM

cat <<DELIM > 1pkjsonmap.csv
pk,j
0,"{""a"":1,""b"":""value""}"
DELIM

cat <<DELIM > 1pkjsonarray.csv
pk,j
1,"[1,2,3]"
DELIM

cat <<DELIM > 1pklongtext.csv
pk,t
1,imzinjwrqbntxwvroeilncaqtfhmvyapmkfwydcprxuobofasoqqsjikrpbfbiugifrxbudrdxvpngeucqfhkjubuctibzgunzitfpiezccgdosjspbajeoykgvubrnmpxggvdrmjgqebhkzjiihmktiieuxwuxandzgazahztuuslydjxyhtmntslbvfbiknhhaomdeeyljrccskfewldpsunsqtiuxnebzelvlolnxubroofbdacyjizzpscioymhbtmmyfxtcpkccdwgkiyhdbrgnwgaudrqhpvyidvgxelvdmbbetvusfdqsvpvttzxuvgnfoycytavufzpkixewauaaqsofyovcbeyhjwznwzyfrvaqxyrovcywauydgvecnbgedcvqolhtodmrgkskmmavfeotujjbadilledpwkykrjhrpppqamqxbeajjtzrvwpdzowbqksbevexidoltpulwgmlxlrcfxvobjgjscvhpzkatmzbusxhoxidjjudwoultrtaiyilwgwsxurpbcclnnegtmdopzewidzexgbraxywryimsukugxoxyzhghsbqfasmgevrrpntijskjtxvrchuoxbllqijgtvodzdxdobudibkaoghsyfuehftilybmfujrkkxvwnfyonapzyipxlnktcfxmhirfspqkyltdmmwscvyamjwiuagvrqcnrtsibidngypeqcbdqipdlswztmqrwfmsilihaxokcbfhahdwluequvdgiurbomlahecltccevdimtzugehsnuycjlnebnladjvvuvoleamjhlpuspfmgowdahqxizfbsayfhiwfbbyfgljhqzilyqvlpwxytlqdynbyjchgbcaidrbvxldnzmgmsleixgttsclzrutmjoqfqocaifssztaoqsshhlghwoanutrnaylpnijgmkhktvzqteflvnconisnbdssleeuakcqcigssjobqibwzruqqitjmujwhuwefmnozsyftdimilpwczbttkspjitnxmafrdjlabaklsjudbkdqzidtlvjakyandguqcrhqogsxhbfmfvpnyotbswjcsqtxtcvvrsgfmyrwyhqkadoggzmzugwbzazmuigrntjsdyxfmcpapxlqyllbegwscwfpluehtxebgdluffqkgzlbmrjopnefnmlahmubrtmcphakkmgaikjeigfoxszvunwabicsrxiaaodeizqdwdrgczoquvtjuykdvzghrpghvtvvnbnyhswwzfghjduprszznbqsmcbmjkoywbaxbpbnejmzfqnrhilutxnhctsnvmebqyljnpnghvmaziyhhxxonojrjxrvjapqxhmimxpkpkvrmpsoldqjxwpccuayuwvasqgmphpvmtnyojgihlniffdoobdcrgmxnycithvwekvgeyynlckxndmtjoiluecvfivvegyhaiwrqenzaeovugcligvdcrcfwhiiqojajeihxztnhxhqaktnwblvvwrgcvyfbqncgktxsvrrfdesdsxjaoiseoqmcsceospawxabjaladbrjhsninefqybahoezxwdcsqjnmvmzugepiohamlwdgxxjmljnqxzffxjixxhyehsfifoucgkdlnnduollhzwweynujukmnaxnjtynpjwssdhzmdhpkxxxdpymtimozatzfopatlknlluujitqgallwqswlfdgovdymgelractxmckameulrvnurhmpwojnkztbjuwmcrxwzsqenhxwjuwfldqtltagwsnufhsetnromyvfuajivuthqxpplzdzevjahlphnidjowjydclwaeoylvoibtvnnohkepmvdhilspxunubrmxmgqponogwujbtvmcucclvfterepzppbdonqcqhlsjthsiajxmjfkzvkxezroieyqqbbsicuuniqnnigqmzncuctptatlosunxxxfikvgvnigkohxdsopacubidnzcxyxwyexsulzuawzuxecogwpawimrudwgsjfsrjdjgimevisqgvqdotqtzvxogmuvevfmgihsrvcgiuaafoockbqmepmcsjsijyzrksqmcdtuyzcopvsfjyqxmdvnrlrownchedabcrfmrjzbvctbcqfgrxgqtijranslelbmwrrpqnwbookahuavrncyclbcieuoedprgounqgtxygjqkwjqzofiacpvkjsyrjpumxypgixkpldtfpldnmniiiyxbnhodthjlqheyicnpxtlutdmtrxsqgadhxqrwsgimjcmjbpfklwaqsgqxhjqkqgtpnjkwfhwrbnpkjqtefjddqptcshkahkovktjmxibuyzxgjswbdantucqxyqdanprxouopmbanbgwzkbqyohnlbevwxhcuvwvsofhjbgadbgkqusxtnkeaxiyihfkjidtastpplehadkvftpdlivflodekmpdfwsyvbcdttmgicvcqoaehvlgtgbdslwuueuqausjjxufijvonjlfkffmhgaoodmavqpcssqzbvqxdpfbauagvgoutikngdmfyoirihginzwrmotgdyzojahtamsjraxjfyyupnwjhfjgrgyzdlrkqnktxppldjcuaulvimnbccwjcjbynbizpfdfoeblsodjzketiefebxafsfkmsrjyimdjsbkyfyfqimpqdzkmsyfsswhmjefwbtqcteeshebwwzfisaxzexfiooecgoxjfqykshoqtriaiwsnsmfcxtsrmrwrudfmojiyeqglhlbutjvmokejtduojtznosdajgfgnvahhewdvdqflpeasltsqgnbxqnqccnczqrfcrvusbipyblmfupgbbnoqxtgowajozffcsmienpxmlnynsyvealrubnihepvgxbsetyobrfqoabtjhigrlgvbmdaswquahwcddkzsnqovrbikdnylpiemqpsaipnnhmdwitzdqxouedqmomidiuaxhdvhogzjmzezbkikplwnbymqezsndvjfsnervwpwsykwmmjsrazxuxeyctyclxhezhmhhnsmbesrhdnxspdbgcbekyzhlwfaqzwukhtryrpaearbhcjkkgticegjvpoujkouqecwroznscpsrlabfnbolynfptktfjxzwrqkquchszwaqhtgzpcghmcwwhbwbojlphhyjalgrtctqfligyxxajdpcuaopqymczfammytovljaetumbqcyfsukrxdjtifhsdzmqanfjjugyhuqftzhuiqahrltsowvecbkbsxlqswrikbzifjjfgztpbampvebnoupmfbihcraofsqfngxbrsjqpymilbcrquwnbyiduqdwocabptgfqzjnienzhqaltshdhljjvkoxnyslgridqjwgebpzpanwqmfwsczodqmyalfwgmuxrvagkjryvbvqhnzgfgmlpxuejfgmbmjrwlefozibqdgaujxgrskgevwmgeuohciwuwxrighkrlgwecmablejkgxdzxhzexlcxnnexmilmuatknvhaxtnahjfzudrfuytdbounertogvicfncnbbxzglczeevvlywjzbbwuzhqfxshtzkyknnplublkmljkrmanoqhdtqpmfkernutmgxeasvbfhepfokbqwrtysrxemriveuwqtndfbxhihtdyqbmhqgkwibrtxlcvmtajdbqfrfvdbmxkyaeijycdzvvohxtrwbhibtbpwufdsgymjbgeiykclcxemeieuofwacxweoeoaonvawgjvqkzzsanlugdjldcaffqocywheipjpgcsjpnrefuahgbhcucbdtwsalwugjlehiuitdgmsmoqvwtqwzjfkjjkkdpucyowqmfreoebuznwlghnfzgyqtjkpyhrsyunvdhrtkubdbqltyrqdwgoajeqgiaivthzmvwiehgjgfnaqnzthisiwlnnekwhbonjxhbozarowlqsxnzbrmrvdgarorhoeclqcisyqbkfqsxztrekoeayuoavedjaepaapcohdleijxksjbqyejsolwodjyqaymdjerwuglakawdzfhwtptcdhhontmvwgczgcgrtbqzclakgclsnuaxwqcdmgpnedrrecivaaznxyncchazvgtnlrcyvxqbwnrfqrccwapjgpqgxzrezhxxfxfokojirmmhgkcbjchiojwhbqayqkvcxhusxsknjjpenchcbsxgbxshsmwfdyuywcmatrwaamnrnopkqoryldzjkjvpvbdqutdlsjyfsvzgglbbfrrjvgrxtzuedkxymjcfejhdljmdqtimgrxdazicvdiqoyfxzojnrswrxvjktalmvtcpomdiqyyheoiablzmqgiayhksmnqkdpuadmtziplmqihprihrksayriqmpawsupaffmhokqjzxzpfncryohbwooddpnebeivgpklnmyitmagigqrahwmprhgmfghajhlfuqvwyyhrrolyxzhtsookexramcxcktcgxsnswqanfnsvchcozvdngkekstmskpcgetyzmuyaikmqlnoijuohgmegpeatjngirqtwkslkbsmqpwdaalbtiqfoljfauwspigblfwrtvlwlrvkyhlglxnuqkggkjeuwerzmsiajfxuasunfglcrcycbqwqtnllvhqehskqxtnedfrgpwlezwdghcznwlsddheifqrbloiqsxuvqrlxyvwraayzgcdewbopfomhrxiubkovpmdzjsrfhdafltcafxpcxbbyygqmvjijprhlsuswqrxpeudlmnvauzisylomgokpvrybjsxrubjwqhcpptrlfxjvtuchrnohdrfuqahkqqhgydiydsqhzmlbenwbgddtuetlftagfejzesatdgkjxikcdfggcgiabjpzorftvzfnbizpegtaykcioeymllgewxyiomdbevhaxxdwaxhnghdwvftdvqonzjnjpiwfikwowhzmettgpntbrbrfakqhbcmwvutosnugdohagliejtftcdxdgdpyrzsqmqcvpmhvcfpszhmvqyhrgaodiaiijrtseubbubozvnppwbvhrxllurcycwxudnqbegtcbiwovglitxhiwjhydhwsexafkvpzjdgjjrhuwynbdedcbvjxypjspipcnhllrrbokdtzsditkpxkyktnebszbldnsfwlrsyyiylxwoxysqfujuhgvbrfqfxxxgknpbpdftwfhlkysyyedrioopuoisrrrvwhxisiqanlogedfzkfhcamrqugctkgrjeumzgfosjgbbxgaebachrtwrubwsywzqlchpbxediaxsvuevvzxqtticpguladcypsnuenepufumcismswmlxhqkyuwqjjwdoqtdnkeshpuuaaekwayfiwhwmcydgfnmybhwtloidjqunvyezeycqnldljigadwgpoekzqswmetnksmowunatpwwzuudajpmeoqifyolbzsysqndbpbjskhamduqlccgpzwoolxqtymaypnlvlxmzghvunrgtklcjiinrrblefcrmiubvrhkedcmzfqjbpyyrhajctbwcwzrvgrllqhcgccltxajniaxcsylnnwfmfxhfghwlqtzntkivtgzomzjsslkqfktilbufkmsukttrpbevtpuxwvmyhxocgwzafekaahsecewmqhbudxwaadipfephxzctxaxvlruqzyubnptxexhrbkwjyeexdqbnejvexpntdthzcqftttrnkdsysolobwndpcmvnyeqzhmtstfgpzgrmidlmwjrjxeutbepnqtefimygqrjujqjpaumfosikdpxtptjptnvsdzomfgovpqvggnawxdarrtnahjydbouyrkwjruzgpzfgqoiqtdibdwggeugeepblhipobtktufskiwixvdjkhjgnvxsaxwcbjgqehlnurjwnjctwmhafkctwlrqjpvatigdfvuftwvqohoabtyztxhfsreroezhdwapqpsrnkgeszzompdaaxxhmwiqjelkjczmnovotipnrrpgfavexmhqlizcznrjsixgrsmbylahplomeblrfgoxbjsmhhrjskoivgcwdhyylisjdsrucwiezshvjqlstycspegvzlocowdtzmacgplanudotdeqicmvtgzfxtcppkwjfmyjurshhxeggchdegdcsmlasypeioszxfbqvrdhibwubhcvjuzcevushtvolgligzppqsaoymtwthejzajspqixfhgvbbcylumqlfqmfvpnroaogrundewtvbcuiuuzmiqnruowgshjngrdidgkutxqpdzcdnoyujbgqioenuzalpqsquroaiuxduizwhuznlzcmxwpbdgyjejpvluhdxlhmovgogfmaiavjlhgnmiihnjejgeznxianhmtwnorxussxvvwocaiadopwcxupkfrhxeicozmgojnhxnvfttuivoljlsgkrfuhiqyygrrqlnelqrypbvjhmbmzgrhbugdlrsyawozgwahujnwhuwanutoinbgqssdoapfsmvlgvlhnrdmajgwlymojmgrbkictcpllmmlaolpfemkgrcythkazozmgjmjsxehudlkxmgsevszenrbucayevgkwjznnjlssimtvjevwbahcucfantaerorvsimleoblzvztgrbuwrnoufjyoigyujnhexogiqaygcprxzihbeturjlcyawcgwzwfsiegmwgzupdjgayukvdonisgdwwlcsmtqijjkhwevimszxuqslesqmhkylgwhfbbbthsdgvjgbmicrzlveppdqjwqfmwwjxfxuzvpdiflfrfljypqpyvhxkyiwozczooherrwxmupmafubkoyaayxburlcmygmspqwradslurmqbqahklkaesbrbcrvliaunsatytozbjbgadflfebkrtjadjyqftljiksjcmlrjwhhwkywxujtofkqxhlggciupioqwvwvebuknonqqauhbrvybfozmlrudoqhdekbjjclrxgzxntourtjjdnzttqrslunjznqezormkjxjdwcwsvvsupvjvyudakufmqzqqnvnpwmhuqlohzjtsolyupmropvbqqklxfizshjgzgdnjsxykbewdtjzpyytqssgjcgdwuxyikfephhnvnwlpjvbexvdysgqfbjosdfifajzqpukpzpzzwncpfvgnquvokxonaglizskzjdmexrdmseyfjpczqxewgyobxhmywjkufjajlmeqzjembjddxugvuzhioqeqvqkwoypnskadkvraardpzuhlayibxrpmilppbgmrzlzyffaxzzsgukeubzfgequjbtpdvsirjqbtevzcdqlcbsfugrhsvkprmuypagmokhfbvovhzebmgjrdaatonhuaqtsvgghenzxcpspygoyryjytyksbctpoqdgegzphkexyvqmuzvnjuysfgaljnmcvnvjvpodxoqwxzyqpplzdgelzzopcyyrmzshxdpofvzwdrzmjohbutglvkdxmrhdvbnnrzaimwngqsftlcgpxewglpmyivpevhzormedutmwjudbpwzpducqldugeoyuyicmktbevuzmijzdjawusegmevufcfqewweogindtisosnfixmlywoxqjhtbmgqatmokubuqkbbrjciofnrdyekiutsqqitoovmrnwpyigwmhqhchgcvqbxumigexpmszamktgrzwffmllxwhhghqnueryidqktisjhvzpudqykkwgagkgzxxbkcppujbxolhiyqkcfvublusyrdpgvjkqdgrznfjmhuguclyddjccrvaeytvisodqswglazpwwzjlerzxuwqqmikaigwuufudaxilnraeueigwfqcvtxerwnpwxfejnqeiskpetgfllkvwgtcjmgertnweotxthadkwogqrsviluhyfwifiznzzukvbmftxrsfolffzuoxyclmacakyqcvyziuwijjrgboxlmelmplrmcxmvskomztmmpnfalzhsoprqfewypjumhitadnlvrcaqukohhbfetrzctmctkcxbqcskycnvfwzoygvvpopuhfvwpiligtdcdfjgsaipnduorlvopvsirenqsswllgqyomrisleeivemgwggerkswqrdfzcanqidirwrhuunbwfgjnuuceyizfazezvvmahapikuyjxsovvhctvlvqghjmkscmwljteqhtrbzngeyxrpgqfpvuxgqqbordilmhzxsryofeygwozwcszsycfyrbzlokhsznuxtkaoofdqtrukdxhblchlvzimqhbffnihaxeumqjatxwwtwnvkvfvppirczzkdiufgdmzeewfdworpqbdfpntwntdnltzowkvtsrugahcjahsnrnljnmvalypdkalbguzlphlkmccqgddappjjoiclzjpujtbfdwxfnvxqueoscnhrcgfifnvvbfshjdxafwgqvsffvkioncczaguglhmegndesrcxaagsukggzulezqsmmjopujnsvkavgxdwsibamlicckadetbadpjoxxnuohtgrwojyrltiyqbyfqwfncudrqahvkjqvrvsvuqdmqljqogxmoqgebtqimypyqokidtscekkbrorlqsaxfjynotybwbjthgvzaukjvphmrwezmycbxwnlttqxlavgirszjsrchkdeixbyxsnfyrbgzieeystnnawawzmmszbgmkagltcmwuzbarqcxlmbsgxbjbinbyeyhyuwymuxkbpqswkuwdkfjsannfcxdbephnootlxvkgdqccbmlcdnwbojbpjxbntxarzklvkqkkrvzqjhxgxynysrtennksoqiwfalpysocrowcnomqmbwjnpdvikbatrtnixflqtqmytuopxthrogcctqdrcyeccyyzgwuvojtcwvsswprvoaogjqcevwjjshjyilkptvjhruiiazbhcjqatwjybinqsjlppwwovdvgnnxhrrigcinojytaomnxrlpngemxezbgubkimukbtqjpiyxshvfvqnusclvuafmwvgicxhxfhmuzinabvswptvvctotkgjrpsvgouthvklufucjacumyaoscpvwlegtbxcryrgeafurvjnoiqmspboiteclrllukpcjddudorpplxvevwivbmqukpgvomnhxpuqpytwtlokxzqayphmsnztqqkmprtiyersstucbxbosushkazcgwinahamztalkcafaitlksgyipeelvqziqantawlebaeccjjxsavorzpuwxwlygttgzsykymgctwgyqfbisfaajpaihxijprvvgbmafgwmtbczdfasxohtewylijerhsmfcnjzlhuptatkfbfjexblcursmkmhhuhnppppctqxcqxveufzfahbzfkvcwgvhyuomovudbhvnwhdqqmzzyqztkawosauudcujpfdimoknblcgbzcystzfwvyalxsvbtpmhhbrybjnwnknzmkadcsbmhbvohgnndcjfdtvegwhvidyppxacenkpsnqtybpjfcyfmbegjqhnklbkkoaistysojrnquyisxrepdwxtvlxpjhfjzekevkkypexxpinahegmpzmopvhixrmewqszyakmsyzgsuhqexclymlossyvwvtpgwcjztvedccqtcryidmqupwkrdjgiizereajmgixlurbrgrahielwtlehoisceajmfwteslckawgfviogialbtxwrzrxuvkeblyfamikduylmnypowbxehnwesejcesejssbmuuodjyakyshevghcbbpyggwirickqcwodbkfgldlfsrqaqnfhrtmsxmomctmxpzsxptrcxfpjjpmkkylfpkqxskcpznvegiujayyaeuknwkopfunauxmgwtdlkrhbfvusfrxvgjuzcbeoeznilcooccsnyquebtuonekjkhsembqrtigryglqulzrxmpewvmcxurmcytrhxdcepmkoxityliljekkoficoflvedhngajwowdruetpvfezvkfxtmerlijoxgiuekeozqunyouzpafrqjxwmkhczgdwkxwqlzeqehdapgogehvjzeigfnffedzwfgdmbnuhmfalxxfmmwsldzjdkfynnbhspfgiinffdscdkjxzoutwrbptupyydjjsnnqbbmmyuyxwqgahypsilwqlcwdcoyyxkrupnofljiuxwdrnaeeabfrpruebvxzjppcjkyolngzfmmoyrjlcmxkzmbpaffvtegvjwsvozlowaexddkwrarpowmqsjgogkvnebjxrbyjpavmlauhittozprdyfypcytgoscdsqtjmigszonevrzkbnesextihskpdopoqesiyofxhxavmcvynfbcpnqhaniqdieeoejrwkjfdslegesljibbcwwrydouxuwkkikapgmwkjduelbvujojxzftawwamjdbdyltqtayumvkuzxnulksbcttmosxzjkeetrsmgdtpdhaemwdehdhhlmlctvmxaqnpxplkqujsofsiuowlxyptmgtjwevhdwnwczwbcjkhwisgbhnghbhhozxixatkaqmeqtlajajclryreuiugdxuethaedravgjifurfcmoovbcuzdfnzgbvadqdygloktddbenktalpvuyzglcajlblvaftuulqswmkdwsmpiqtytqygwboogjthlefgjmwmyikygwpdddqmrffvxmtiecksgypxtjqbilizculyffgicwtqdzjfeligeocyxjrlboqretfkssirnldfmovxeweplfgeblraelqvuexrurhtwdsizkmxpnntppuujxpeuewaylmwirbqfupwqcxoifadsmcwfoyhlxcpphtckbjfytlunsgbmaoyynwttubehlehhqnpxqdpbunntxpxhsmkhvztlbajnmglwkkcmcxpoqnmkxxderezsblkocpfqoblhqbmzivazjzdqltvvbomzpfxkohkzyovjgdjcntcnuayzbwvbbalboucshezuflknytkajcefuibstolzaeymjtsjrbrwpoopbsztuzbmglyqmaphnklmakuovatkybqfubiirevflkiisksfulpbnctjqevmirdiyyuvpwswlqhoomvckjqkrqtzgushutgnvaqpnnnxtgtjrvrhfceneimksbbrktslgllfzmqsohuckcjgqosyafnqmhggziywomogfrfuphblummkoturmibrpuskhabpxlqfbqwcqyshhrbpraqzcfkieycdbttvhlvxyvatlqctqzplpmwwrtxxtnxmvoehqejvgsoauecwidnleeqprjqzsigsqbxerludnagjaawflqftrikulrgspchkikuhwlsnksihpllqcqcbctxvlzmmgvxkgvozdqfcfuupwuhagcqlcslzfuabtpcjpszjeakbdjhdwqjvnqklwddwqfyfqurggmgsiwbppruiullyatfhdqslcvzgmcibyskfqcplloaoejijlhyxebfywnchkkfewyyxjwihmiasxoljvgmkuolmcvqedbesmidaoizmjujpotdwuymoatxlbhtixzibyqzjzosdtscvkrpitzjcohttmjbicruafgofqjvtcwsbnminynpbibhblbxpnnqoacsdysakodblvcgbxxislkrutidjwpztmsluzabvknsgtytixelizxjlxgnlbgeicigofaaymodujdzbvspfhywjkgtjlhewnayrztkmdeoandefxhayguselqdvpngucrucwgecqpgwerhaejpxwvdudhkrynyjzqadnuymrismhfwftrmvqfciztsyhfmptlzuhjdoabwvjgkjpbhirelxnefyodtrqqtidtjkymlvhseimfenxjjfpitiolkcbgeehiszsbjrwpdfyevhghhytbirtueqkijoujixfioayyoejpunrsbcftcqlgloobpynnasevgoomtiuzgdpymvhqogsdoebjnxdaarziajqyonfqysmsgifsoiskjuzhxgzgoyfdmqcgvhzuopezwokztzroruingkwbhluhtzcbqnvbfoturwswnvvcczffypxsbvtepykicpcbjhmpwkvvinkuhiqdxcfbqvrirbizwxdsssccynvsvpvsyslqpwbawdblgtzwmcootoolnrphgqnnsnxvvyobratcucejfqnzmesvbfjipewwlsurmmqsfiydxycmcsuaeuifswrtxijjntrhosuunxolsupcgwlowgvpilllayzylocqapktnazqdjrxlctrlwnjplrpgsqjosmqxuohrjrqakhuivmwjtwnytkisvmxoipvglkchlulzmwjpzqhfqocyvudahxtsyuwzzppbrprazyxdibmxnnmbrmdzganroswistlyapvkgkzswkgjwsfhayrehpjgzwdxfdujtlumrtsgcxlaygyesdcepxgsqwswqrujhgbvgcvomvretwfgqrknhrrklurtqudezlvuojewbvufysigpqfwqwcbsuepubacmlpjbkjkzonjyagbdqtzeuujjtmnpyzjwvsoetkhfvbwbjcjifadckpxsarsxavkmyzcgzenmujtnolagrxgitzfrzzmlsysngbptlplkvbxklvicvgoxopohnpunnnhbdfocyqysihwawvlpcttbrwnbcnacjwepwlkeqdrpecyjwrdpwbidrltrwuaqqrzwtxgvpiwbptldffmlejaowzhpwzrzqmwqcyifpknmhrlfcfcmatksnzgspbhcwtomojgdroobptadwhtcxbalsvqflianuigbqaotnlapdpujbnplwkmcbekfncwfkjtwxyixgrptdvsqhrirpdemdaiebzgoucidvzqxnipbgqxpveqkvugfzwqervxgtqwprxbtxdpgajtoklxoswwbovwnyjtylwpctyqmaijhxreaclzzkrqgddeljslbopjqdntddwlmlpbroavdqmmupxnxawnwypxgamwoqwdugebsfequutrrtspisnrmtouqiizpzgnfgbfqhitwckzrcfwnixbyjbfmnqjdicbfhlzxmikmrbgqycpweluoqeultyunnmyyeohtkyfbmxpxnhfqjhkhrgrqwfpsdtkscrctrzenopxzyqtkhqljtoylvrzzolqeazhfxhhyhywfthvilxuugydlqmsvmtadwkypelbmbyxytdgtrgfucnjgsmuaeaiubyzqjwbwkwjvcmgkhejfwgkjmjdqrzuzveipfjbswvrctnqdiceeydgsorqrinfveumtdbwmgkyxzvnufyjlaxjcjudsgttzwgluvbajnnjcobkctgwiiedonudfvcgkqkukbzoanxlsxpagsscgeyyqyzasnvtzbrhnoljmuktsyahqgialfdmnifqhfahiaimlrvovvmodkdduyiccserjuqiwhpneuccglckstuwskapbmpfjgfodgvrjadyvzgromfrfinkkecnityecmnjzrigxybjwhhtguwsstgykxeyjesfghnivepcigfykiornhenfttgrehuqiexccfbtyzhnfsdgfrpxpjujctppvttlddxopwydzrbkpqykwbkksgyvmciyelrnzbfltcvoqmjdxomonopnqyevrdyxxvypxsxlevvebppdbcugxcpumripjdsznptnmvmabfngavlfsmqcpcgfgavgdovynkhzpvnuxelcbchtfezcecvwgwwoyydywyrfwtbrchawfylgappclgdqxjhcdjuulvrmggfixszqwdjfpuuxruftgdjovwwnyvnheywjxbybzgdlqbhdnykckuizdahmtkkzytuqfhepebrjvdsoykvmseunwizmowtqxffrcqtgcgrvbxietchnerrzjkoxwnouyiclfiltmttbmcgoqrpsfovetwchkenjcpisqgxnnsmgxeidmazesdgztdwdwtskmgzzcqvizirpiflydzoghvmboudmqlwgpdteueuwpteqrxwjpfxlzlfynylyaihksoddtlotmhkrgiuawbmcaafzsgzncivlxcbdoaxfviollbegiddvsmzdofiemmsqzfrwcvlqmdqitkusrnlpqpbfejerhmtxouwonksagjvztehckfwusgauehlgzrmxnpvlmrpfzxqhabhhklwwjveyomaqlozalbecvzcgyqdixgzvlxclxhzwqnhmwpmdwbigrxjysokfuqrhmtcsukmrgplzrotephvgcssborhslgxcyqbppewbxbdchmhlffyqnxajswztvhsgzkfwevnggreqeogkhytuopvfaarbezcmizwjppbfkfnwikezbgxeygiesxpgegvbspeofvwtcipjwnusszmuqxbbirqivtuzpwsypbzalpcjnddrsvrvyzeiydikcntajssvevkmwhcmzbydyyegkhysvolyplbhusgculxzpxqggbpkjghyqlldxgodnleodfejqzhocsupvlbmfrtzfnszukqsjlyzwljtucivlqldzrxakcwxkguosmqtppnpktbfxerpxzooseaaehhzbixoqszhrvmrvuidgxvbjqxlfptsoltrkzivuhdwfaoslifcifkbbcydghljekdinqwsiqdofgdfkmgpwvfukclpreofviiwewewgibwzydgemrcdxzjiimsoqhmrogorrkxuyeyhwofiwhxuabjrdeijdnnnshdiexqeaufhlbyciqrvwrsknoqtdfogdeaegtwawokgpvovwcriwscbsbbgadhlwqvdmkecfyrcbpxezicuvviuimefjdmibnztsrltwygepnozstpfrvkaisvcobdprkgekufythdxgjebzeufdudhrngodskzkxcfuoqwsbpiakcvgucarqgdrgnoxjrqhphucgutuwqhhpxebbqglntdtslwxfvgvtkdwqpweworlksyqxaiiaezkwrngrgsluadvqlqhblnlrdfwquaqnygynfciqyieqgyncfffsuhumqxrhgqdzzddginjidzfwqjnxrcfevscmpxbgitnkksnplwdsrqmrhaclpirhbhqlwcgubbsiyrnhjoeohhhplobegyepjqeiitywqpcqgwnkpmqfdpdpxvedywxghjoqcpjqsgczivzmdomhgdlgllmwfffojljmzpqijcpkmmszvxovrwvphbzrirzappfblblelnhggfayrunxparxkjblctpplhezkcxtxfxbnrejjqtgmtaoocacojvvahluwspxchgyhhfceygbkffdjvosbqticxtdekaddjkvlucmasuixpwumvfmqwdovjmzxqzzzknmsvxtyqepaqbyzzelbvrgtoykigsqjeaioqujuaypwduxdigjphikmlvwatxbyacatwwosrvhqoshgitrqhmvmyruipfqijojcmunwmlcqczyypywoelhsronvpkaklyuulnbrlxzsabaitqyckjgxuhdjuyayqyvxkjpqfsyjjhtafmckivmnvssohwhnrhbyqrumbatvjrivlslwfwjeguwbcviuzqoyywtjokrgfsdhqwipfvkzhunqcrdszrmpzwojechlhzfbsqmwdxdnrknunvnquzvzydxhhxxfxcuzrhqoeenxulqtiuiljmbsimgnxkbjuvesbeopznjmhqswatiudoagrzwmqtwtivtjhwivjkpuwyrxfplyotkmkzgimkvxhpqoqjgwtzpctruylffrardbipmmqnmgdobvhhhnnnfsiacnhrswggefjxjwqiiattumeuwjltpdgnxgbuoygnxcfvgrifxdjbbfuzrstzjckmqnajyjulpsicaavnfenjhwntlfjzvjlxlxbgbbyzatomxtdwoemyjodiukowizngxhkqswcorceflxerlieqndvgudopqdlngpopbwvsqgqhctzeuzrywbhypzhftigusocddftbfajfclpvwcdwsybyomvoucdyyywfvrtcmanojooamdvbxgsbfxnxvvjuuiccbwmxrdfblcmszdgkgziolhyoiktikhxfvdjkwwxyrzxpwdhpnprdpgpnfqxeaqrjjorvdqbcsevzvmuxtyicgxcwgyugdiucyougwahnfxfnl
DELIM

cat <<DELIM > 1pksupportedtypes.csv
Expand Down Expand Up @@ -72,6 +87,28 @@ teardown() {
! [[ "$output" =~ "test" ]] || false
}

@test "schema-import: import json type" {
run dolt schema import --dry-run -c --pks=pk test 1pkjsonmap.csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 5 ]
[[ "${lines[0]}" =~ "test" ]] || false
[[ "$output" =~ "\`j\` json" ]] || false

run dolt schema import --dry-run -c --pks=pk test 1pkjsonarray.csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 5 ]
[[ "${lines[0]}" =~ "test" ]] || false
[[ "$output" =~ "\`j\` json" ]] || false
}

@test "schema-import: import long text" {
run dolt schema import --dry-run -c --pks=pk test 1pklongtext.csv
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 5 ]
[[ "${lines[0]}" =~ "test" ]] || false
[[ "$output" =~ "\`t\` text" ]] || false
}

@test "schema-import: with a bunch of types" {
run dolt schema import --dry-run -c --pks=pk test 1pksupportedtypes.csv
[ "$status" -eq 0 ]
Expand Down

0 comments on commit a5f6a31

Please sign in to comment.