diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 51bceae..ef3e6d6 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -2,7 +2,7 @@ name: .NET on: push: - branches: [ master, image_processing_proto, functions_support ] + branches: [ master, image_processing_proto ] pull_request: branches: [ master, image_processing_proto, functions_support ] @@ -13,6 +13,10 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Install libc6-dev + run: sudo apt-get install libc6-dev + - name: Install libgdiplus + run: sudo apt-get install libgdiplus - name: Setup .NET uses: actions/setup-dotnet@v1 with: diff --git a/ImageProcessing/.gitignore b/ImageProcessing/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/ImageProcessing/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/ImageProcessing/FuncRegistration.cs b/ImageProcessing/FuncRegistration.cs new file mode 100644 index 0000000..9ba186a --- /dev/null +++ b/ImageProcessing/FuncRegistration.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MetadataManager; +using PageManager; +using QueryProcessing; +using QueryProcessing.Exceptions; +using QueryProcessing.Functions; +using QueryProcessing.Utilities; + +namespace ImageProcessing +{ + public class ImageObjectClassificationFuncMappingHandler : IFunctionMappingHandler + { + public MetadataColumn GetMetadataInfoForOutput(Sql.valueOrFunc.FuncCall func, MetadataColumn[] metadataColumns) + { + const int MaxReturnTypeLength = 256; + ColumnType[] columnTypes = FuncCallMapper.ExtractCallTypes(func, metadataColumns); + + if (columnTypes.Length != 1) + { + throw new InvalidFunctionArgument("Object classification requires 1 argument (image path)"); + } + + if (columnTypes[0] != ColumnType.String && columnTypes[0] != ColumnType.StringPointer) + { + throw new InvalidFunctionArgument("invalid argument type for object classification"); + } + + return new MetadataColumn(0, 0, "Object_Classification_Result", new ColumnInfo(ColumnType.String, MaxReturnTypeLength)); + } + + public IFunctionCall MapToFunctor(ColumnType[] args) + { + if (args.Length != 1) + { + throw new InvalidFunctionArgument("Object classification requires 1 argument (image path)"); + } + + if (args[0] != ColumnType.String && args[0] != ColumnType.StringPointer) + { + throw new InvalidFunctionArgument("invalid argument type for object classification"); + } + + return new ImageObjectClassificationFunctor(); + } + } + + public class ImageObjectClassificationFunctor : IFunctionCall + { + public void ExecCompute(RowHolder inputRowHolder, RowHolder outputRowHolder, Union2Type[] sourceArguments, int outputPosition) + { + FunctorArgChecks.CheckInputArguments(sourceArguments, new[] { ColumnType.String }); + FunctorArgExtractString arg = new FunctorArgExtractString(inputRowHolder, sourceArguments); + const string inceptionPb = "tensorflow_inception_graph.pb"; + const string labelsTxt = "imagenet_comp_graph_label_strings.txt"; + + TFModelImageLabelScorer scorer = new TFModelImageLabelScorer(inceptionPb, labelsTxt); + ImageLabelPredictionProbability score = scorer.ScoreSingle(arg.ArgOne); + + outputRowHolder.SetField(outputPosition, score.PredictedLabels[0].ToCharArray()); + } + + public IComparable ExecCompute(RowHolder inputRowHolder, Union2Type[] sourceArguments) + { + FunctorArgChecks.CheckInputArguments(sourceArguments, new[] { ColumnType.String }); + FunctorArgExtractString arg = new FunctorArgExtractString(inputRowHolder, sourceArguments); + throw new NotImplementedException(); + } + } +} diff --git a/ImageProcessing/ImageDataSource.cs b/ImageProcessing/ImageDataSource.cs new file mode 100644 index 0000000..cde5f2b --- /dev/null +++ b/ImageProcessing/ImageDataSource.cs @@ -0,0 +1,22 @@ +using Microsoft.ML.Data; + +namespace ImageProcessing +{ + public class ImageDataSource + { + [LoadColumn(0)] + public string ImagePath; + } + + public class ImageLabelPredictionProbability : ImageDataSource + { + public string[] PredictedLabels; + public float[] Probabilities { get; set; } + } + + public class ImageLabelPrediction + { + [ColumnName(TFModelImageLabelScorer.InceptionSettings.outputTensorName)] + public float[] PredictedLabels; + } +} diff --git a/ImageProcessing/ImageProcessing - Backup.csproj b/ImageProcessing/ImageProcessing - Backup.csproj new file mode 100644 index 0000000..f8cb483 --- /dev/null +++ b/ImageProcessing/ImageProcessing - Backup.csproj @@ -0,0 +1,24 @@ + + + + netcoreapp3.1 + + + + + + + + + + + + Always + + + + + + + + diff --git a/ImageProcessing/ImageProcessing.csproj b/ImageProcessing/ImageProcessing.csproj new file mode 100644 index 0000000..f8cb483 --- /dev/null +++ b/ImageProcessing/ImageProcessing.csproj @@ -0,0 +1,24 @@ + + + + netcoreapp3.1 + + + + + + + + + + + + Always + + + + + + + + diff --git a/ImageProcessing/TFModelImageLabelScorer.cs b/ImageProcessing/TFModelImageLabelScorer.cs new file mode 100644 index 0000000..000cfee --- /dev/null +++ b/ImageProcessing/TFModelImageLabelScorer.cs @@ -0,0 +1,128 @@ +using Microsoft.ML; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +namespace ImageProcessing +{ + public class TFModelImageLabelScorer + { + private readonly string modelLocation; + private readonly string labelsLocation; + private readonly MLContext mlContext; + + private static string ImageReal = nameof(ImageReal); + + private readonly PredictionEngine model; + + private static string GetAssetsPath() + { + FileInfo dataRoot = new FileInfo(typeof(TFModelImageLabelScorer).Assembly.Location); + string assemblyFolderPath = dataRoot.Directory.FullName; + return Path.Combine(assemblyFolderPath, "assets_image_processing"); + } + + public TFModelImageLabelScorer(string modelFileName, string labelsFileName) + { + string assetsPath = GetAssetsPath(); + this.modelLocation = Path.Combine(assetsPath, modelFileName); + this.labelsLocation = Path.Combine(assetsPath, labelsFileName); + this.mlContext = new MLContext(); + this.model = LoadModel(modelLocation); + + } + + public struct ImageNetSettings + { + public const int imageHeight = 224; + public const int imageWidth = 224; + public const float mean = 117; + public const bool channelsLast = true; + public const int returnTopNLabels = 10; + public const float probabilityThreshold = 0.1f; + } + + public struct InceptionSettings + { + // input tensor name + public const string inputTensorName = "input"; + + // output tensor name + public const string outputTensorName = "softmax2"; + } + + public ImageLabelPredictionProbability ScoreSingle(string path) + { + return PredictDataUsingModelSinge(labelsLocation, path); + } + + private IEnumerable LoadSource() + { + return Enumerable.Empty(); + } + + private PredictionEngine LoadModel(string modelLocation) + { + // Don't train anything. + // Keep the source empty and feed with when scorer is invoked. + // TODO: This is ugly. Not sure if there is a nicer way to do this. + var data = mlContext.Data.LoadFromEnumerable(LoadSource()); + + var pipeline = mlContext.Transforms.LoadImages(outputColumnName: "input", imageFolder: ".", inputColumnName: nameof(ImageDataSource.ImagePath)) + .Append(mlContext.Transforms.ResizeImages(outputColumnName: "input", imageWidth: ImageNetSettings.imageWidth, imageHeight: ImageNetSettings.imageHeight, inputColumnName: "input")) + .Append(mlContext.Transforms.ExtractPixels(outputColumnName: "input", interleavePixelColors: ImageNetSettings.channelsLast, offsetImage: ImageNetSettings.mean)) + .Append(mlContext.Model.LoadTensorFlowModel(modelLocation). + ScoreTensorFlowModel(outputColumnNames: new[] { "softmax2" }, + inputColumnNames: new[] { "input" }, addBatchDimensionInput: true)); + + ITransformer model = pipeline.Fit(data); + + var predictionEngine = mlContext.Model.CreatePredictionEngine(model); + + return predictionEngine; + } + + protected ImageLabelPredictionProbability PredictDataUsingModelSinge(string labelsLocation, string path) + { + string[] labels = File.ReadAllLines(labelsLocation); + + ImageDataSource dataSource = new ImageDataSource() { ImagePath = path }; + + var probs = this.model.Predict(dataSource).PredictedLabels; + var bestLabels = GetBestLabels(labels, probs, ImageNetSettings.returnTopNLabels); + + return new ImageLabelPredictionProbability() + { + ImagePath = dataSource.ImagePath, + PredictedLabels = bestLabels.Item1, + Probabilities = bestLabels.Item2, + }; + } + + private static (string[], float[]) GetBestLabels(string[] labels, float[] probs, int topN) + { + // TODO: This is naive slow implementation. + List bestLabels = new List(); + List bestProbabilities = new List(); + var lblsList = labels.ToList(); + var probsList = probs.ToList(); + + for (int i = 0; i < topN; i++) + { + var max = probsList.Max(); + var index = probsList.IndexOf(max); + + if (max >= ImageNetSettings.probabilityThreshold) + { + bestLabels.Add(lblsList[index]); + bestProbabilities.Add(max); + } + + lblsList.RemoveAt(index); + probsList.RemoveAt(index); + } + + return (bestLabels.ToArray(), bestProbabilities.ToArray()); + } + } +} diff --git a/ImageProcessing/assets_image_processing/imagenet_comp_graph_label_strings.txt b/ImageProcessing/assets_image_processing/imagenet_comp_graph_label_strings.txt new file mode 100644 index 0000000..0ac5a16 --- /dev/null +++ b/ImageProcessing/assets_image_processing/imagenet_comp_graph_label_strings.txt @@ -0,0 +1,1001 @@ +dummy +kit fox +English setter +Siberian husky +Australian terrier +English springer +grey whale +lesser panda +Egyptian cat +ibex +Persian cat +cougar +gazelle +porcupine +sea lion +malamute +badger +Great Dane +Walker hound +Welsh springer spaniel +whippet +Scottish deerhound +killer whale +mink +African elephant +Weimaraner +soft-coated wheaten terrier +Dandie Dinmont +red wolf +Old English sheepdog +jaguar +otterhound +bloodhound +Airedale +hyena +meerkat +giant schnauzer +titi +three-toed sloth +sorrel +black-footed ferret +dalmatian +black-and-tan coonhound +papillon +skunk +Staffordshire bullterrier +Mexican hairless +Bouvier des Flandres +weasel +miniature poodle +Cardigan +malinois +bighorn +fox squirrel +colobus +tiger cat +Lhasa +impala +coyote +Yorkshire terrier +Newfoundland +brown bear +red fox +Norwegian elkhound +Rottweiler +hartebeest +Saluki +grey fox +schipperke +Pekinese +Brabancon griffon +West Highland white terrier +Sealyham terrier +guenon +mongoose +indri +tiger +Irish wolfhound +wild boar +EntleBucher +zebra +ram +French bulldog +orangutan +basenji +leopard +Bernese mountain dog +Maltese dog +Norfolk terrier +toy terrier +vizsla +cairn +squirrel monkey +groenendael +clumber +Siamese cat +chimpanzee +komondor +Afghan hound +Japanese spaniel +proboscis monkey +guinea pig +white wolf +ice bear +gorilla +borzoi +toy poodle +Kerry blue terrier +ox +Scotch terrier +Tibetan mastiff +spider monkey +Doberman +Boston bull +Greater Swiss Mountain dog +Appenzeller +Shih-Tzu +Irish water spaniel +Pomeranian +Bedlington terrier +warthog +Arabian camel +siamang +miniature schnauzer +collie +golden retriever +Irish terrier +affenpinscher +Border collie +hare +boxer +silky terrier +beagle +Leonberg +German short-haired pointer +patas +dhole +baboon +macaque +Chesapeake Bay retriever +bull mastiff +kuvasz +capuchin +pug +curly-coated retriever +Norwich terrier +flat-coated retriever +hog +keeshond +Eskimo dog +Brittany spaniel +standard poodle +Lakeland terrier +snow leopard +Gordon setter +dingo +standard schnauzer +hamster +Tibetan terrier +Arctic fox +wire-haired fox terrier +basset +water buffalo +American black bear +Angora +bison +howler monkey +hippopotamus +chow +giant panda +American Staffordshire terrier +Shetland sheepdog +Great Pyrenees +Chihuahua +tabby +marmoset +Labrador retriever +Saint Bernard +armadillo +Samoyed +bluetick +redbone +polecat +marmot +kelpie +gibbon +llama +miniature pinscher +wood rabbit +Italian greyhound +lion +cocker spaniel +Irish setter +dugong +Indian elephant +beaver +Sussex spaniel +Pembroke +Blenheim spaniel +Madagascar cat +Rhodesian ridgeback +lynx +African hunting dog +langur +Ibizan hound +timber wolf +cheetah +English foxhound +briard +sloth bear +Border terrier +German shepherd +otter +koala +tusker +echidna +wallaby +platypus +wombat +revolver +umbrella +schooner +soccer ball +accordion +ant +starfish +chambered nautilus +grand piano +laptop +strawberry +airliner +warplane +airship +balloon +space shuttle +fireboat +gondola +speedboat +lifeboat +canoe +yawl +catamaran +trimaran +container ship +liner +pirate +aircraft carrier +submarine +wreck +half track +tank +missile +bobsled +dogsled +bicycle-built-for-two +mountain bike +freight car +passenger car +barrow +shopping cart +motor scooter +forklift +electric locomotive +steam locomotive +amphibian +ambulance +beach wagon +cab +convertible +jeep +limousine +minivan +Model T +racer +sports car +go-kart +golfcart +moped +snowplow +fire engine +garbage truck +pickup +tow truck +trailer truck +moving van +police van +recreational vehicle +streetcar +snowmobile +tractor +mobile home +tricycle +unicycle +horse cart +jinrikisha +oxcart +bassinet +cradle +crib +four-poster +bookcase +china cabinet +medicine chest +chiffonier +table lamp +file +park bench +barber chair +throne +folding chair +rocking chair +studio couch +toilet seat +desk +pool table +dining table +entertainment center +wardrobe +Granny Smith +orange +lemon +fig +pineapple +banana +jackfruit +custard apple +pomegranate +acorn +hip +ear +rapeseed +corn +buckeye +organ +upright +chime +drum +gong +maraca +marimba +steel drum +banjo +cello +violin +harp +acoustic guitar +electric guitar +cornet +French horn +trombone +harmonica +ocarina +panpipe +bassoon +oboe +sax +flute +daisy +yellow lady's slipper +cliff +valley +alp +volcano +promontory +sandbar +coral reef +lakeside +seashore +geyser +hatchet +cleaver +letter opener +plane +power drill +lawn mower +hammer +corkscrew +can opener +plunger +screwdriver +shovel +plow +chain saw +cock +hen +ostrich +brambling +goldfinch +house finch +junco +indigo bunting +robin +bulbul +jay +magpie +chickadee +water ouzel +kite +bald eagle +vulture +great grey owl +black grouse +ptarmigan +ruffed grouse +prairie chicken +peacock +quail +partridge +African grey +macaw +sulphur-crested cockatoo +lorikeet +coucal +bee eater +hornbill +hummingbird +jacamar +toucan +drake +red-breasted merganser +goose +black swan +white stork +black stork +spoonbill +flamingo +American egret +little blue heron +bittern +crane +limpkin +American coot +bustard +ruddy turnstone +red-backed sandpiper +redshank +dowitcher +oystercatcher +European gallinule +pelican +king penguin +albatross +great white shark +tiger shark +hammerhead +electric ray +stingray +barracouta +coho +tench +goldfish +eel +rock beauty +anemone fish +lionfish +puffer +sturgeon +gar +loggerhead +leatherback turtle +mud turtle +terrapin +box turtle +banded gecko +common iguana +American chameleon +whiptail +agama +frilled lizard +alligator lizard +Gila monster +green lizard +African chameleon +Komodo dragon +triceratops +African crocodile +American alligator +thunder snake +ringneck snake +hognose snake +green snake +king snake +garter snake +water snake +vine snake +night snake +boa constrictor +rock python +Indian cobra +green mamba +sea snake +horned viper +diamondback +sidewinder +European fire salamander +common newt +eft +spotted salamander +axolotl +bullfrog +tree frog +tailed frog +whistle +wing +paintbrush +hand blower +oxygen mask +snorkel +loudspeaker +microphone +screen +mouse +electric fan +oil filter +strainer +space heater +stove +guillotine +barometer +rule +odometer +scale +analog clock +digital clock +wall clock +hourglass +sundial +parking meter +stopwatch +digital watch +stethoscope +syringe +magnetic compass +binoculars +projector +sunglasses +loupe +radio telescope +bow +cannon [ground] +assault rifle +rifle +projectile +computer keyboard +typewriter keyboard +crane +lighter +abacus +cash machine +slide rule +desktop computer +hand-held computer +notebook +web site +harvester +thresher +printer +slot +vending machine +sewing machine +joystick +switch +hook +car wheel +paddlewheel +pinwheel +potter's wheel +gas pump +carousel +swing +reel +radiator +puck +hard disc +sunglass +pick +car mirror +solar dish +remote control +disk brake +buckle +hair slide +knot +combination lock +padlock +nail +safety pin +screw +muzzle +seat belt +ski +candle +jack-o'-lantern +spotlight +torch +neck brace +pier +tripod +maypole +mousetrap +spider web +trilobite +harvestman +scorpion +black and gold garden spider +barn spider +garden spider +black widow +tarantula +wolf spider +tick +centipede +isopod +Dungeness crab +rock crab +fiddler crab +king crab +American lobster +spiny lobster +crayfish +hermit crab +tiger beetle +ladybug +ground beetle +long-horned beetle +leaf beetle +dung beetle +rhinoceros beetle +weevil +fly +bee +grasshopper +cricket +walking stick +cockroach +mantis +cicada +leafhopper +lacewing +dragonfly +damselfly +admiral +ringlet +monarch +cabbage butterfly +sulphur butterfly +lycaenid +jellyfish +sea anemone +brain coral +flatworm +nematode +conch +snail +slug +sea slug +chiton +sea urchin +sea cucumber +iron +espresso maker +microwave +Dutch oven +rotisserie +toaster +waffle iron +vacuum +dishwasher +refrigerator +washer +Crock Pot +frying pan +wok +caldron +coffeepot +teapot +spatula +altar +triumphal arch +patio +steel arch bridge +suspension bridge +viaduct +barn +greenhouse +palace +monastery +library +apiary +boathouse +church +mosque +stupa +planetarium +restaurant +cinema +home theater +lumbermill +coil +obelisk +totem pole +castle +prison +grocery store +bakery +barbershop +bookshop +butcher shop +confectionery +shoe shop +tobacco shop +toyshop +fountain +cliff dwelling +yurt +dock +brass +megalith +bannister +breakwater +dam +chainlink fence +picket fence +worm fence +stone wall +grille +sliding door +turnstile +mountain tent +scoreboard +honeycomb +plate rack +pedestal +beacon +mashed potato +bell pepper +head cabbage +broccoli +cauliflower +zucchini +spaghetti squash +acorn squash +butternut squash +cucumber +artichoke +cardoon +mushroom +shower curtain +jean +carton +handkerchief +sandal +ashcan +safe +plate +necklace +croquet ball +fur coat +thimble +pajama +running shoe +cocktail shaker +chest +manhole cover +modem +tub +tray +balance beam +bagel +prayer rug +kimono +hot pot +whiskey jug +knee pad +book jacket +spindle +ski mask +beer bottle +crash helmet +bottlecap +tile roof +mask +maillot +Petri dish +football helmet +bathing cap +teddy bear +holster +pop bottle +photocopier +vestment +crossword puzzle +golf ball +trifle +suit +water tower +feather boa +cloak +red wine +drumstick +shield +Christmas stocking +hoopskirt +menu +stage +bonnet +meat loaf +baseball +face powder +scabbard +sunscreen +beer glass +hen-of-the-woods +guacamole +lampshade +wool +hay +bow tie +mailbag +water jug +bucket +dishrag +soup bowl +eggnog +mortar +trench coat +paddle +chain +swab +mixing bowl +potpie +wine bottle +shoji +bulletproof vest +drilling platform +binder +cardigan +sweatshirt +pot +birdhouse +hamper +ping-pong ball +pencil box +pay-phone +consomme +apron +punching bag +backpack +groom +bearskin +pencil sharpener +broom +mosquito net +abaya +mortarboard +poncho +crutch +Polaroid camera +space bar +cup +racket +traffic light +quill +radio +dough +cuirass +military uniform +lipstick +shower cap +monitor +oscilloscope +mitten +brassiere +French loaf +vase +milk can +rugby ball +paper towel +earthstar +envelope +miniskirt +cowboy hat +trolleybus +perfume +bathtub +hotdog +coral fungus +bullet train +pillow +toilet tissue +cassette +carpenter's kit +ladle +stinkhorn +lotion +hair spray +academic gown +dome +crate +wig +burrito +pill bottle +chain mail +theater curtain +window shade +barrel +washbasin +ballpoint +basketball +bath towel +cowboy boot +gown +window screen +agaric +cellular telephone +nipple +barbell +mailbox +lab coat +fire screen +minibus +packet +maze +pole +horizontal bar +sombrero +pickelhaube +rain barrel +wallet +cassette player +comic book +piggy bank +street sign +bell cote +fountain pen +Windsor tie +volleyball +overskirt +sarong +purse +bolo tie +bib +parachute +sleeping bag +television +swimming trunks +measuring cup +espresso +pizza +breastplate +shopping basket +wooden spoon +saltshaker +chocolate sauce +ballplayer +goblet +gyromitra +stretcher +water bottle +dial telephone +soap dispenser +jersey +school bus +jigsaw puzzle +plastic bag +reflex camera +diaper +Band Aid +ice lolly +velvet +tennis ball +gasmask +doormat +Loafer +ice cream +pretzel +quilt +maillot +tape player +clog +iPod +bolete +scuba diver +pitcher +matchstick +bikini +sock +CD player +lens cap +thatch +vault +beaker +bubble +cheeseburger +parallel bars +flagpole +coffee mug +rubber eraser +stole +carbonara +dumbbell \ No newline at end of file diff --git a/ImageProcessing/assets_image_processing/tensorflow_inception_graph.pb b/ImageProcessing/assets_image_processing/tensorflow_inception_graph.pb new file mode 100644 index 0000000..b71afb3 Binary files /dev/null and b/ImageProcessing/assets_image_processing/tensorflow_inception_graph.pb differ diff --git a/PageManager/RowHolder.cs b/PageManager/RowHolder.cs index eaa5003..22997f7 100644 --- a/PageManager/RowHolder.cs +++ b/PageManager/RowHolder.cs @@ -65,7 +65,7 @@ public RowHolder(ColumnType[] columnTypes) for (int i = 0; i < columnTypes.Length - 1; i++) { - this.ColumnPosition[i + 1] = (byte)(this.ColumnPosition[i] + ColumnTypeSize.GetSize(columnTypes[i])); + this.ColumnPosition[i + 1] = (short)(this.ColumnPosition[i] + ColumnTypeSize.GetSize(columnTypes[i])); } int totalSize = this.ColumnPosition[columnTypes.Length - 1] + ColumnTypeSize.GetSize(columnTypes[columnTypes.Length - 1]); @@ -79,7 +79,7 @@ public RowHolder(ColumnInfo[] columnTypes, byte[] byteArr) for (int i = 0; i < columnTypes.Length - 1; i++) { - this.ColumnPosition[i + 1] = (byte)(this.ColumnPosition[i] + columnTypes[i].GetSize()); + this.ColumnPosition[i + 1] = (short)(this.ColumnPosition[i] + columnTypes[i].GetSize()); } this.Storage = byteArr; @@ -94,7 +94,7 @@ public RowHolder(ColumnInfo[] columnTypes) for (int i = 0; i < columnTypes.Length - 1; i++) { - this.ColumnPosition[i + 1] = (byte)(this.ColumnPosition[i] + columnTypes[i].GetSize()); + this.ColumnPosition[i + 1] = (short)(this.ColumnPosition[i] + columnTypes[i].GetSize()); } this.Storage = storage; diff --git a/ParserLexerFSharp/Sql.fs b/ParserLexerFSharp/Sql.fs index 21a1b9e..eabd5f5 100644 --- a/ParserLexerFSharp/Sql.fs +++ b/ParserLexerFSharp/Sql.fs @@ -53,6 +53,8 @@ type sqlStatement = and sqlStatementOrId = | FromTable of string | FromSubquery of sqlStatement + // Path + extension filter + | FileSystemProvider of value type columntype = IntCType | StringCType | DoubleCType // columntype + rep count + name. diff --git a/ParserLexerFSharp/SqlLexer.fs b/ParserLexerFSharp/SqlLexer.fs index c1665f5..c1fec3c 100644 --- a/ParserLexerFSharp/SqlLexer.fs +++ b/ParserLexerFSharp/SqlLexer.fs @@ -1,12 +1,12 @@ # 1 "SqlLexer.fsl" - + module SqlLexer -open System -open SqlParser +open System +open SqlParser open FSharp.Text.Lexing -let keywords = - [ +let keywords = + [ "CREATE", CREATE "INSERT", INSERT "INTO", INTO @@ -16,38 +16,39 @@ let keywords = "TYPE_INT", TYPE_INT "TYPE_DOUBLE", TYPE_DOUBLE "TYPE_STRING", TYPE_STRING - "SELECT", SELECT; - "FROM", FROM; - "WHERE", WHERE; - "ORDER", ORDER; - "BY", BY; - "JOIN", JOIN; - "INNER", INNER; - "LEFT", LEFT; - "RIGHT", RIGHT; - "ASC", ASC; - "DESC", DESC; - "AND", AND; - "OR", OR; - "ON", ON; + "SELECT", SELECT; + "FROM", FROM; + "FILESYSTEM", FILESYSTEM; + "WHERE", WHERE; + "ORDER", ORDER; + "BY", BY; + "JOIN", JOIN; + "INNER", INNER; + "LEFT", LEFT; + "RIGHT", RIGHT; + "ASC", ASC; + "DESC", DESC; + "AND", AND; + "OR", OR; + "ON", ON; "GROUP", GROUP; "MAX", MAX; "MIN", MIN; "COUNT", COUNT; "SUM", SUM; "TOP", TOP; - ] |> Map.ofList + ] |> Map.ofList -let ops = - [ - "=", EQ; - "<", LT; - "<=", LE; - ">", GT; - ">=", GE; - ] |> Map.ofList +let ops = + [ + "=", EQ; + "<", LT; + "<=", LE; + ">", GT; + ">=", GE; + ] |> Map.ofList -# 50 "SqlLexer.fs" +# 51 "SqlLexer.fs" let trans : uint16[] array = [| (* State 0 *) @@ -100,66 +101,66 @@ let rec _fslex_dummy () = _fslex_dummy() and tokenize lexbuf = match _fslex_tables.Interpret(0,lexbuf) with | 0 -> ( -# 64 "SqlLexer.fsl" +# 65 "SqlLexer.fsl" tokenize lexbuf -# 105 "SqlLexer.fs" +# 106 "SqlLexer.fs" ) | 1 -> ( -# 65 "SqlLexer.fsl" +# 66 "SqlLexer.fsl" lexbuf.EndPos <- lexbuf.EndPos.NextLine; tokenize lexbuf; -# 110 "SqlLexer.fs" +# 111 "SqlLexer.fs" ) | 2 -> ( -# 66 "SqlLexer.fsl" +# 67 "SqlLexer.fsl" INT(Int32.Parse(LexBuffer<_>.LexemeString lexbuf)) -# 115 "SqlLexer.fs" +# 116 "SqlLexer.fs" ) | 3 -> ( -# 67 "SqlLexer.fsl" +# 68 "SqlLexer.fsl" FLOAT(Double.Parse(LexBuffer<_>.LexemeString lexbuf)) -# 120 "SqlLexer.fs" +# 121 "SqlLexer.fs" ) | 4 -> ( -# 68 "SqlLexer.fsl" +# 69 "SqlLexer.fsl" ops.[LexBuffer<_>.LexemeString lexbuf] -# 125 "SqlLexer.fs" +# 126 "SqlLexer.fs" ) | 5 -> ( -# 69 "SqlLexer.fsl" - match keywords.TryFind(LexBuffer<_>.LexemeString lexbuf) with - | Some(token) -> token +# 70 "SqlLexer.fsl" + match keywords.TryFind(LexBuffer<_>.LexemeString lexbuf) with + | Some(token) -> token | None -> ID(LexBuffer<_>.LexemeString lexbuf) -# 132 "SqlLexer.fs" +# 133 "SqlLexer.fs" ) | 6 -> ( -# 72 "SqlLexer.fsl" +# 73 "SqlLexer.fsl" COMMA -# 137 "SqlLexer.fs" +# 138 "SqlLexer.fs" ) | 7 -> ( -# 73 "SqlLexer.fsl" +# 74 "SqlLexer.fsl" EOF -# 142 "SqlLexer.fs" +# 143 "SqlLexer.fs" ) | 8 -> ( -# 74 "SqlLexer.fsl" +# 75 "SqlLexer.fsl" OBRCK -# 147 "SqlLexer.fs" +# 148 "SqlLexer.fs" ) | 9 -> ( -# 75 "SqlLexer.fsl" +# 76 "SqlLexer.fsl" CBRCK -# 152 "SqlLexer.fs" +# 153 "SqlLexer.fs" ) | 10 -> ( -# 76 "SqlLexer.fsl" +# 77 "SqlLexer.fsl" QUOT -# 157 "SqlLexer.fs" +# 158 "SqlLexer.fs" ) | 11 -> ( -# 77 "SqlLexer.fsl" +# 78 "SqlLexer.fsl" STAR -# 162 "SqlLexer.fs" +# 163 "SqlLexer.fs" ) | _ -> failwith "tokenize" diff --git a/ParserLexerFSharp/SqlLexer.fsl b/ParserLexerFSharp/SqlLexer.fsl index 8a2e260..4e97f07 100644 --- a/ParserLexerFSharp/SqlLexer.fsl +++ b/ParserLexerFSharp/SqlLexer.fsl @@ -1,11 +1,11 @@ -{ +{ module SqlLexer -open System -open SqlParser +open System +open SqlParser open FSharp.Text.Lexing -let keywords = - [ +let keywords = + [ "CREATE", CREATE "INSERT", INSERT "INTO", INTO @@ -15,42 +15,43 @@ let keywords = "TYPE_INT", TYPE_INT "TYPE_DOUBLE", TYPE_DOUBLE "TYPE_STRING", TYPE_STRING - "SELECT", SELECT; - "FROM", FROM; - "WHERE", WHERE; - "ORDER", ORDER; - "BY", BY; - "JOIN", JOIN; - "INNER", INNER; - "LEFT", LEFT; - "RIGHT", RIGHT; - "ASC", ASC; - "DESC", DESC; - "AND", AND; - "OR", OR; - "ON", ON; + "SELECT", SELECT; + "FROM", FROM; + "FILESYSTEM", FILESYSTEM; + "WHERE", WHERE; + "ORDER", ORDER; + "BY", BY; + "JOIN", JOIN; + "INNER", INNER; + "LEFT", LEFT; + "RIGHT", RIGHT; + "ASC", ASC; + "DESC", DESC; + "AND", AND; + "OR", OR; + "ON", ON; "GROUP", GROUP; "MAX", MAX; "MIN", MIN; "COUNT", COUNT; "SUM", SUM; "TOP", TOP; - ] |> Map.ofList + ] |> Map.ofList -let ops = - [ - "=", EQ; - "<", LT; - "<=", LE; - ">", GT; - ">=", GE; - ] |> Map.ofList +let ops = + [ + "=", EQ; + "<", LT; + "<=", LE; + ">", GT; + ">=", GE; + ] |> Map.ofList } -let char = ['a'-'z' 'A'-'Z'] -let digit = ['0'-'9'] -let int = '-'?digit+ -let float = '-'?digit+ '.' digit+ +let char = ['a'-'z' 'A'-'Z'] +let digit = ['0'-'9'] +let int = '-'?digit+ +let float = '-'?digit+ '.' digit+ let identifier = char(char|digit|['-' '_' '.'])* let whitespace = [' ' '\t'] let newline = "\n\r" | '\n' | '\r' @@ -60,16 +61,16 @@ let quotation = "\'" let openbracket = "(" let closedbracket = ")" -rule tokenize = parse -| whitespace { tokenize lexbuf } -| newline { lexbuf.EndPos <- lexbuf.EndPos.NextLine; tokenize lexbuf; } -| int { INT(Int32.Parse(LexBuffer<_>.LexemeString lexbuf)) } -| float { FLOAT(Double.Parse(LexBuffer<_>.LexemeString lexbuf)) } -| operator { ops.[LexBuffer<_>.LexemeString lexbuf] } -| identifier { match keywords.TryFind(LexBuffer<_>.LexemeString lexbuf) with - | Some(token) -> token - | None -> ID(LexBuffer<_>.LexemeString lexbuf) } -| ',' { COMMA } +rule tokenize = parse +| whitespace { tokenize lexbuf } +| newline { lexbuf.EndPos <- lexbuf.EndPos.NextLine; tokenize lexbuf; } +| int { INT(Int32.Parse(LexBuffer<_>.LexemeString lexbuf)) } +| float { FLOAT(Double.Parse(LexBuffer<_>.LexemeString lexbuf)) } +| operator { ops.[LexBuffer<_>.LexemeString lexbuf] } +| identifier { match keywords.TryFind(LexBuffer<_>.LexemeString lexbuf) with + | Some(token) -> token + | None -> ID(LexBuffer<_>.LexemeString lexbuf) } +| ',' { COMMA } | eof { EOF } | openbracket { OBRCK } | closedbracket { CBRCK } diff --git a/ParserLexerFSharp/SqlParser.fs b/ParserLexerFSharp/SqlParser.fs index bf44f0a..5fa4c17 100644 --- a/ParserLexerFSharp/SqlParser.fs +++ b/ParserLexerFSharp/SqlParser.fs @@ -11,6 +11,7 @@ open Sql // This type is the type of tokens accepted by the parser type token = | TOP + | FILESYSTEM | STAR | QUOT | EOF @@ -58,6 +59,7 @@ type token = // This type is used to give symbolic names to token indexes, useful for error messages type tokenId = | TOKEN_TOP + | TOKEN_FILESYSTEM | TOKEN_STAR | TOKEN_QUOT | TOKEN_EOF @@ -139,101 +141,103 @@ type nonTerminalId = let tagOfToken (t:token) = match t with | TOP -> 0 - | STAR -> 1 - | QUOT -> 2 - | EOF -> 3 - | TYPE_INT -> 4 - | TYPE_DOUBLE -> 5 - | TYPE_STRING -> 6 - | VALUES -> 7 - | INTO -> 8 - | INSERT -> 9 - | CBRCK -> 10 - | OBRCK -> 11 - | TABLE -> 12 - | DROP -> 13 - | CREATE -> 14 - | ASC -> 15 - | DESC -> 16 - | CREATE_TABLE -> 17 - | MAX -> 18 - | MIN -> 19 - | COUNT -> 20 - | SUM -> 21 - | SELECT -> 22 - | FROM -> 23 - | WHERE -> 24 - | ORDER -> 25 - | BY -> 26 - | GROUP -> 27 - | JOIN -> 28 - | INNER -> 29 - | LEFT -> 30 - | RIGHT -> 31 - | ON -> 32 - | EQ -> 33 - | LT -> 34 - | LE -> 35 - | GT -> 36 - | GE -> 37 - | COMMA -> 38 - | AND -> 39 - | OR -> 40 - | STRING _ -> 41 - | FLOAT _ -> 42 - | INT _ -> 43 - | ID _ -> 44 + | FILESYSTEM -> 1 + | STAR -> 2 + | QUOT -> 3 + | EOF -> 4 + | TYPE_INT -> 5 + | TYPE_DOUBLE -> 6 + | TYPE_STRING -> 7 + | VALUES -> 8 + | INTO -> 9 + | INSERT -> 10 + | CBRCK -> 11 + | OBRCK -> 12 + | TABLE -> 13 + | DROP -> 14 + | CREATE -> 15 + | ASC -> 16 + | DESC -> 17 + | CREATE_TABLE -> 18 + | MAX -> 19 + | MIN -> 20 + | COUNT -> 21 + | SUM -> 22 + | SELECT -> 23 + | FROM -> 24 + | WHERE -> 25 + | ORDER -> 26 + | BY -> 27 + | GROUP -> 28 + | JOIN -> 29 + | INNER -> 30 + | LEFT -> 31 + | RIGHT -> 32 + | ON -> 33 + | EQ -> 34 + | LT -> 35 + | LE -> 36 + | GT -> 37 + | GE -> 38 + | COMMA -> 39 + | AND -> 40 + | OR -> 41 + | STRING _ -> 42 + | FLOAT _ -> 43 + | INT _ -> 44 + | ID _ -> 45 // This function maps integer indexes to symbolic token ids let tokenTagToTokenId (tokenIdx:int) = match tokenIdx with | 0 -> TOKEN_TOP - | 1 -> TOKEN_STAR - | 2 -> TOKEN_QUOT - | 3 -> TOKEN_EOF - | 4 -> TOKEN_TYPE_INT - | 5 -> TOKEN_TYPE_DOUBLE - | 6 -> TOKEN_TYPE_STRING - | 7 -> TOKEN_VALUES - | 8 -> TOKEN_INTO - | 9 -> TOKEN_INSERT - | 10 -> TOKEN_CBRCK - | 11 -> TOKEN_OBRCK - | 12 -> TOKEN_TABLE - | 13 -> TOKEN_DROP - | 14 -> TOKEN_CREATE - | 15 -> TOKEN_ASC - | 16 -> TOKEN_DESC - | 17 -> TOKEN_CREATE_TABLE - | 18 -> TOKEN_MAX - | 19 -> TOKEN_MIN - | 20 -> TOKEN_COUNT - | 21 -> TOKEN_SUM - | 22 -> TOKEN_SELECT - | 23 -> TOKEN_FROM - | 24 -> TOKEN_WHERE - | 25 -> TOKEN_ORDER - | 26 -> TOKEN_BY - | 27 -> TOKEN_GROUP - | 28 -> TOKEN_JOIN - | 29 -> TOKEN_INNER - | 30 -> TOKEN_LEFT - | 31 -> TOKEN_RIGHT - | 32 -> TOKEN_ON - | 33 -> TOKEN_EQ - | 34 -> TOKEN_LT - | 35 -> TOKEN_LE - | 36 -> TOKEN_GT - | 37 -> TOKEN_GE - | 38 -> TOKEN_COMMA - | 39 -> TOKEN_AND - | 40 -> TOKEN_OR - | 41 -> TOKEN_STRING - | 42 -> TOKEN_FLOAT - | 43 -> TOKEN_INT - | 44 -> TOKEN_ID - | 47 -> TOKEN_end_of_input - | 45 -> TOKEN_error + | 1 -> TOKEN_FILESYSTEM + | 2 -> TOKEN_STAR + | 3 -> TOKEN_QUOT + | 4 -> TOKEN_EOF + | 5 -> TOKEN_TYPE_INT + | 6 -> TOKEN_TYPE_DOUBLE + | 7 -> TOKEN_TYPE_STRING + | 8 -> TOKEN_VALUES + | 9 -> TOKEN_INTO + | 10 -> TOKEN_INSERT + | 11 -> TOKEN_CBRCK + | 12 -> TOKEN_OBRCK + | 13 -> TOKEN_TABLE + | 14 -> TOKEN_DROP + | 15 -> TOKEN_CREATE + | 16 -> TOKEN_ASC + | 17 -> TOKEN_DESC + | 18 -> TOKEN_CREATE_TABLE + | 19 -> TOKEN_MAX + | 20 -> TOKEN_MIN + | 21 -> TOKEN_COUNT + | 22 -> TOKEN_SUM + | 23 -> TOKEN_SELECT + | 24 -> TOKEN_FROM + | 25 -> TOKEN_WHERE + | 26 -> TOKEN_ORDER + | 27 -> TOKEN_BY + | 28 -> TOKEN_GROUP + | 29 -> TOKEN_JOIN + | 30 -> TOKEN_INNER + | 31 -> TOKEN_LEFT + | 32 -> TOKEN_RIGHT + | 33 -> TOKEN_ON + | 34 -> TOKEN_EQ + | 35 -> TOKEN_LT + | 36 -> TOKEN_LE + | 37 -> TOKEN_GT + | 38 -> TOKEN_GE + | 39 -> TOKEN_COMMA + | 40 -> TOKEN_AND + | 41 -> TOKEN_OR + | 42 -> TOKEN_STRING + | 43 -> TOKEN_FLOAT + | 44 -> TOKEN_INT + | 45 -> TOKEN_ID + | 48 -> TOKEN_end_of_input + | 46 -> TOKEN_error | _ -> failwith "tokenTagToTokenId: bad token" /// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production @@ -258,72 +262,74 @@ let prodIdxToNonTerminal (prodIdx:int) = | 16 -> NONTERM_SelectStatement | 17 -> NONTERM_fromStatement | 18 -> NONTERM_fromStatement - | 19 -> NONTERM_topClause + | 19 -> NONTERM_fromStatement | 20 -> NONTERM_topClause - | 21 -> NONTERM_columnSelect + | 21 -> NONTERM_topClause | 22 -> NONTERM_columnSelect - | 23 -> NONTERM_columnList + | 23 -> NONTERM_columnSelect | 24 -> NONTERM_columnList | 25 -> NONTERM_columnList | 26 -> NONTERM_columnList | 27 -> NONTERM_columnList | 28 -> NONTERM_columnList - | 29 -> NONTERM_aggregate + | 29 -> NONTERM_columnList | 30 -> NONTERM_aggregate | 31 -> NONTERM_aggregate | 32 -> NONTERM_aggregate - | 33 -> NONTERM_joinList + | 33 -> NONTERM_aggregate | 34 -> NONTERM_joinList | 35 -> NONTERM_joinList - | 36 -> NONTERM_joinClause + | 36 -> NONTERM_joinList | 37 -> NONTERM_joinClause | 38 -> NONTERM_joinClause | 39 -> NONTERM_joinClause - | 40 -> NONTERM_joinOnClause + | 40 -> NONTERM_joinClause | 41 -> NONTERM_joinOnClause - | 42 -> NONTERM_conditionList + | 42 -> NONTERM_joinOnClause | 43 -> NONTERM_conditionList | 44 -> NONTERM_conditionList | 45 -> NONTERM_conditionList | 46 -> NONTERM_conditionList | 47 -> NONTERM_conditionList | 48 -> NONTERM_conditionList - | 49 -> NONTERM_whereClause + | 49 -> NONTERM_conditionList | 50 -> NONTERM_whereClause - | 51 -> NONTERM_op + | 51 -> NONTERM_whereClause | 52 -> NONTERM_op | 53 -> NONTERM_op | 54 -> NONTERM_op | 55 -> NONTERM_op - | 56 -> NONTERM_value + | 56 -> NONTERM_op | 57 -> NONTERM_value | 58 -> NONTERM_value | 59 -> NONTERM_value | 60 -> NONTERM_value | 61 -> NONTERM_value - | 62 -> NONTERM_groupByClause + | 62 -> NONTERM_value | 63 -> NONTERM_groupByClause - | 64 -> NONTERM_groupByList + | 64 -> NONTERM_groupByClause | 65 -> NONTERM_groupByList - | 66 -> NONTERM_orderByClause + | 66 -> NONTERM_groupByList | 67 -> NONTERM_orderByClause - | 68 -> NONTERM_orderByList + | 68 -> NONTERM_orderByClause | 69 -> NONTERM_orderByList - | 70 -> NONTERM_orderBy + | 70 -> NONTERM_orderByList | 71 -> NONTERM_orderBy | 72 -> NONTERM_orderBy - | 73 -> NONTERM_funcCall + | 73 -> NONTERM_orderBy | 74 -> NONTERM_funcCall | 75 -> NONTERM_funcCall + | 76 -> NONTERM_funcCall | _ -> failwith "prodIdxToNonTerminal: bad production index" -let _fsyacc_endOfInputTag = 47 -let _fsyacc_tagOfErrorTerminal = 45 +let _fsyacc_endOfInputTag = 48 +let _fsyacc_tagOfErrorTerminal = 46 // This function gets the name of a token as a string let token_to_string (t:token) = match t with | TOP -> "TOP" + | FILESYSTEM -> "FILESYSTEM" | STAR -> "STAR" | QUOT -> "QUOT" | EOF -> "EOF" @@ -373,6 +379,7 @@ let token_to_string (t:token) = let _fsyacc_dataOfToken (t:token) = match t with | TOP -> (null : System.Object) + | FILESYSTEM -> (null : System.Object) | STAR -> (null : System.Object) | QUOT -> (null : System.Object) | EOF -> (null : System.Object) @@ -417,18 +424,18 @@ let _fsyacc_dataOfToken (t:token) = | FLOAT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x | INT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x | ID _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x -let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 1us; 65535us; 10us; 11us; 1us; 65535us; 15us; 16us; 1us; 65535us; 4us; 5us; 1us; 65535us; 6us; 7us; 1us; 65535us; 24us; 25us; 2us; 65535us; 24us; 30us; 31us; 32us; 2us; 65535us; 8us; 9us; 52us; 53us; 1us; 65535us; 43us; 44us; 2us; 65535us; 8us; 42us; 52us; 42us; 1us; 65535us; 42us; 43us; 1us; 65535us; 42us; 58us; 2us; 65535us; 42us; 62us; 60us; 63us; 2us; 65535us; 44us; 45us; 82us; 83us; 2us; 65535us; 44us; 82us; 82us; 82us; 4us; 65535us; 86us; 87us; 90us; 91us; 94us; 95us; 97us; 98us; 6us; 65535us; 99us; 100us; 104us; 105us; 106us; 107us; 112us; 113us; 114us; 115us; 116us; 117us; 1us; 65535us; 45us; 46us; 2us; 65535us; 101us; 102us; 109us; 110us; 15us; 65535us; 15us; 19us; 20us; 21us; 42us; 59us; 60us; 61us; 99us; 101us; 102us; 103us; 104us; 101us; 106us; 101us; 110us; 111us; 112us; 101us; 114us; 101us; 116us; 101us; 149us; 150us; 152us; 153us; 155us; 156us; 1us; 65535us; 46us; 47us; 2us; 65535us; 135us; 136us; 138us; 139us; 1us; 65535us; 47us; 48us; 2us; 65535us; 141us; 142us; 144us; 145us; 2us; 65535us; 141us; 143us; 144us; 143us; 9us; 65535us; 42us; 64us; 60us; 65us; 99us; 109us; 102us; 108us; 104us; 109us; 106us; 109us; 112us; 109us; 114us; 109us; 116us; 109us; |] -let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 7us; 9us; 11us; 13us; 15us; 18us; 21us; 23us; 26us; 28us; 30us; 33us; 36us; 39us; 44us; 51us; 53us; 56us; 72us; 74us; 77us; 79us; 82us; 85us; |] -let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 2us; 1us; 3us; 1us; 3us; 1us; 4us; 1us; 4us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 1us; 6us; 2us; 6us; 8us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 9us; 2us; 9us; 12us; 1us; 9us; 1us; 9us; 1us; 10us; 1us; 10us; 1us; 11us; 1us; 12us; 1us; 12us; 1us; 13us; 1us; 13us; 1us; 14us; 1us; 14us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 2us; 17us; 18us; 1us; 17us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 19us; 1us; 19us; 1us; 21us; 4us; 22us; 24us; 26us; 28us; 1us; 23us; 3us; 24us; 26us; 28us; 1us; 24us; 1us; 25us; 1us; 26us; 1us; 27us; 1us; 28us; 1us; 29us; 1us; 29us; 1us; 29us; 1us; 29us; 1us; 30us; 1us; 30us; 1us; 30us; 1us; 30us; 1us; 31us; 1us; 31us; 1us; 31us; 1us; 31us; 1us; 32us; 1us; 32us; 1us; 32us; 1us; 32us; 2us; 34us; 35us; 1us; 35us; 1us; 36us; 1us; 36us; 1us; 36us; 1us; 36us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 41us; 1us; 41us; 5us; 42us; 43us; 44us; 45us; 47us; 5us; 42us; 43us; 44us; 45us; 47us; 3us; 42us; 43us; 44us; 1us; 43us; 1us; 43us; 1us; 44us; 1us; 44us; 2us; 45us; 47us; 2us; 46us; 48us; 2us; 46us; 48us; 2us; 46us; 48us; 1us; 47us; 1us; 47us; 1us; 48us; 1us; 48us; 1us; 50us; 1us; 50us; 1us; 51us; 1us; 52us; 1us; 53us; 1us; 54us; 1us; 55us; 1us; 56us; 1us; 57us; 3us; 58us; 59us; 60us; 1us; 58us; 1us; 58us; 1us; 59us; 1us; 59us; 1us; 60us; 1us; 60us; 1us; 61us; 4us; 61us; 73us; 74us; 75us; 1us; 63us; 1us; 63us; 1us; 63us; 2us; 64us; 65us; 1us; 65us; 1us; 65us; 1us; 67us; 1us; 67us; 1us; 67us; 2us; 68us; 69us; 1us; 69us; 1us; 69us; 3us; 70us; 71us; 72us; 1us; 71us; 1us; 72us; 3us; 73us; 74us; 75us; 3us; 73us; 74us; 75us; 1us; 73us; 2us; 74us; 75us; 2us; 74us; 75us; 1us; 74us; 1us; 75us; 1us; 75us; 1us; 75us; |] -let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 8us; 10us; 12us; 14us; 16us; 18us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 35us; 37us; 39us; 41us; 43us; 45us; 47us; 49us; 51us; 54us; 56us; 58us; 60us; 62us; 64us; 66us; 68us; 70us; 72us; 74us; 76us; 78us; 80us; 82us; 84us; 86us; 88us; 90us; 92us; 94us; 96us; 98us; 100us; 103us; 105us; 107us; 109us; 111us; 113us; 115us; 117us; 119us; 124us; 126us; 130us; 132us; 134us; 136us; 138us; 140us; 142us; 144us; 146us; 148us; 150us; 152us; 154us; 156us; 158us; 160us; 162us; 164us; 166us; 168us; 170us; 172us; 175us; 177us; 179us; 181us; 183us; 185us; 187us; 189us; 191us; 193us; 195us; 197us; 199us; 201us; 203us; 205us; 207us; 209us; 211us; 217us; 223us; 227us; 229us; 231us; 233us; 235us; 238us; 241us; 244us; 247us; 249us; 251us; 253us; 255us; 257us; 259us; 261us; 263us; 265us; 267us; 269us; 271us; 273us; 277us; 279us; 281us; 283us; 285us; 287us; 289us; 291us; 296us; 298us; 300us; 302us; 305us; 307us; 309us; 311us; 313us; 315us; 318us; 320us; 322us; 326us; 328us; 330us; 334us; 338us; 340us; 343us; 346us; 348us; 350us; 352us; |] -let _fsyacc_action_rows = 158 -let _fsyacc_actionTableElements = [|4us; 32768us; 9us; 10us; 13us; 6us; 14us; 4us; 22us; 8us; 0us; 49152us; 1us; 32768us; 3us; 3us; 0us; 16385us; 1us; 32768us; 12us; 22us; 0us; 16386us; 1us; 32768us; 12us; 28us; 0us; 16387us; 1us; 16404us; 0us; 55us; 0us; 16388us; 1us; 32768us; 8us; 12us; 0us; 16389us; 1us; 32768us; 44us; 13us; 1us; 32768us; 7us; 14us; 1us; 32768us; 11us; 15us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 2us; 32768us; 10us; 17us; 38us; 20us; 1us; 32768us; 3us; 18us; 0us; 16390us; 0us; 16391us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 0us; 16392us; 1us; 32768us; 44us; 23us; 1us; 32768us; 11us; 24us; 3us; 32768us; 4us; 33us; 5us; 35us; 6us; 37us; 2us; 32768us; 10us; 26us; 38us; 31us; 1us; 32768us; 3us; 27us; 0us; 16393us; 1us; 32768us; 44us; 29us; 0us; 16394us; 0us; 16395us; 3us; 32768us; 4us; 33us; 5us; 35us; 6us; 37us; 0us; 16396us; 1us; 32768us; 44us; 34us; 0us; 16397us; 1us; 32768us; 44us; 36us; 0us; 16398us; 1us; 32768us; 11us; 38us; 1us; 32768us; 43us; 39us; 1us; 32768us; 10us; 40us; 1us; 32768us; 44us; 41us; 0us; 16399us; 9us; 32768us; 1us; 57us; 2us; 125us; 18us; 66us; 19us; 70us; 20us; 74us; 21us; 78us; 42us; 124us; 43us; 123us; 44us; 133us; 1us; 32768us; 23us; 49us; 4us; 16417us; 28us; 96us; 29us; 84us; 30us; 88us; 31us; 92us; 1us; 16433us; 24us; 116us; 1us; 16446us; 27us; 134us; 1us; 16450us; 25us; 140us; 0us; 16400us; 2us; 32768us; 11us; 51us; 44us; 50us; 0us; 16401us; 1us; 32768us; 22us; 52us; 1us; 16404us; 0us; 55us; 1us; 32768us; 10us; 54us; 0us; 16402us; 1us; 32768us; 43us; 56us; 0us; 16403us; 0us; 16405us; 1us; 16406us; 38us; 60us; 0us; 16407us; 8us; 32768us; 2us; 125us; 18us; 66us; 19us; 70us; 20us; 74us; 21us; 78us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16408us; 0us; 16409us; 0us; 16410us; 0us; 16411us; 0us; 16412us; 1us; 32768us; 11us; 67us; 1us; 32768us; 44us; 68us; 1us; 32768us; 10us; 69us; 0us; 16413us; 1us; 32768us; 11us; 71us; 1us; 32768us; 44us; 72us; 1us; 32768us; 10us; 73us; 0us; 16414us; 1us; 32768us; 11us; 75us; 1us; 32768us; 44us; 76us; 1us; 32768us; 10us; 77us; 0us; 16415us; 1us; 32768us; 11us; 79us; 1us; 32768us; 44us; 80us; 1us; 32768us; 10us; 81us; 0us; 16416us; 4us; 16417us; 28us; 96us; 29us; 84us; 30us; 88us; 31us; 92us; 0us; 16419us; 1us; 32768us; 28us; 85us; 1us; 32768us; 44us; 86us; 1us; 16424us; 32us; 99us; 0us; 16420us; 1us; 32768us; 28us; 89us; 1us; 32768us; 44us; 90us; 1us; 16424us; 32us; 99us; 0us; 16421us; 1us; 32768us; 28us; 93us; 1us; 32768us; 44us; 94us; 1us; 16424us; 32us; 99us; 0us; 16422us; 1us; 32768us; 44us; 97us; 1us; 16424us; 32us; 99us; 0us; 16423us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16425us; 5us; 32768us; 33us; 118us; 34us; 119us; 35us; 120us; 36us; 121us; 37us; 122us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 2us; 16426us; 39us; 104us; 40us; 106us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16427us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16428us; 1us; 16429us; 39us; 112us; 5us; 32768us; 33us; 118us; 34us; 119us; 35us; 120us; 36us; 121us; 37us; 122us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 1us; 16430us; 40us; 114us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16431us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16432us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 133us; 0us; 16434us; 0us; 16435us; 0us; 16436us; 0us; 16437us; 0us; 16438us; 0us; 16439us; 0us; 16440us; 0us; 16441us; 3us; 32768us; 42us; 128us; 43us; 130us; 44us; 126us; 1us; 32768us; 2us; 127us; 0us; 16442us; 1us; 32768us; 2us; 129us; 0us; 16443us; 1us; 32768us; 2us; 131us; 0us; 16444us; 0us; 16445us; 1us; 16445us; 11us; 149us; 1us; 32768us; 26us; 135us; 1us; 32768us; 44us; 137us; 0us; 16447us; 1us; 16448us; 38us; 138us; 1us; 32768us; 44us; 137us; 0us; 16449us; 1us; 32768us; 26us; 141us; 1us; 32768us; 44us; 146us; 0us; 16451us; 1us; 16452us; 38us; 144us; 1us; 32768us; 44us; 146us; 0us; 16453us; 2us; 16454us; 15us; 147us; 16us; 148us; 0us; 16455us; 0us; 16456us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 2us; 32768us; 10us; 151us; 38us; 152us; 0us; 16457us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 2us; 32768us; 10us; 154us; 38us; 155us; 0us; 16458us; 4us; 32768us; 2us; 125us; 42us; 124us; 43us; 123us; 44us; 132us; 1us; 32768us; 10us; 157us; 0us; 16459us; |] -let _fsyacc_actionTableRowOffsets = [|0us; 5us; 6us; 8us; 9us; 11us; 12us; 14us; 15us; 17us; 18us; 20us; 21us; 23us; 25us; 27us; 32us; 35us; 37us; 38us; 39us; 44us; 45us; 47us; 49us; 53us; 56us; 58us; 59us; 61us; 62us; 63us; 67us; 68us; 70us; 71us; 73us; 74us; 76us; 78us; 80us; 82us; 83us; 93us; 95us; 100us; 102us; 104us; 106us; 107us; 110us; 111us; 113us; 115us; 117us; 118us; 120us; 121us; 122us; 124us; 125us; 134us; 135us; 136us; 137us; 138us; 139us; 141us; 143us; 145us; 146us; 148us; 150us; 152us; 153us; 155us; 157us; 159us; 160us; 162us; 164us; 166us; 167us; 172us; 173us; 175us; 177us; 179us; 180us; 182us; 184us; 186us; 187us; 189us; 191us; 193us; 194us; 196us; 198us; 199us; 204us; 205us; 211us; 216us; 219us; 224us; 225us; 230us; 231us; 233us; 239us; 244us; 246us; 251us; 252us; 257us; 258us; 263us; 264us; 265us; 266us; 267us; 268us; 269us; 270us; 271us; 275us; 277us; 278us; 280us; 281us; 283us; 284us; 285us; 287us; 289us; 291us; 292us; 294us; 296us; 297us; 299us; 301us; 302us; 304us; 306us; 307us; 310us; 311us; 312us; 317us; 320us; 321us; 326us; 329us; 330us; 335us; 337us; |] -let _fsyacc_reductionSymbolCounts = [|1us; 2us; 2us; 2us; 2us; 2us; 7us; 1us; 3us; 6us; 2us; 1us; 3us; 2us; 2us; 5us; 7us; 2us; 5us; 2us; 0us; 1us; 1us; 1us; 3us; 1us; 3us; 1us; 3us; 4us; 4us; 4us; 4us; 0us; 1us; 2us; 4us; 4us; 4us; 3us; 0us; 2us; 3us; 5us; 5us; 3us; 3us; 5us; 5us; 0us; 2us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 3us; 3us; 3us; 1us; 0us; 3us; 1us; 3us; 0us; 3us; 1us; 3us; 1us; 2us; 2us; 4us; 6us; 8us; |] -let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 2us; 2us; 3us; 4us; 4us; 5us; 6us; 7us; 7us; 8us; 8us; 8us; 9us; 10us; 10us; 11us; 11us; 12us; 12us; 13us; 13us; 13us; 13us; 13us; 13us; 14us; 14us; 14us; 14us; 15us; 15us; 15us; 16us; 16us; 16us; 16us; 17us; 17us; 18us; 18us; 18us; 18us; 18us; 18us; 18us; 19us; 19us; 20us; 20us; 20us; 20us; 20us; 21us; 21us; 21us; 21us; 21us; 21us; 22us; 22us; 23us; 23us; 24us; 24us; 25us; 25us; 26us; 26us; 26us; 27us; 27us; 27us; |] -let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 16385us; 65535us; 16386us; 65535us; 16387us; 65535us; 16388us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16390us; 16391us; 65535us; 16392us; 65535us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 16394us; 16395us; 65535us; 16396us; 65535us; 16397us; 65535us; 16398us; 65535us; 65535us; 65535us; 65535us; 16399us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16400us; 65535us; 16401us; 65535us; 65535us; 65535us; 16402us; 65535us; 16403us; 16405us; 65535us; 16407us; 65535us; 16408us; 16409us; 16410us; 16411us; 16412us; 65535us; 65535us; 65535us; 16413us; 65535us; 65535us; 65535us; 16414us; 65535us; 65535us; 65535us; 16415us; 65535us; 65535us; 65535us; 16416us; 65535us; 16419us; 65535us; 65535us; 65535us; 16420us; 65535us; 65535us; 65535us; 16421us; 65535us; 65535us; 65535us; 16422us; 65535us; 65535us; 16423us; 65535us; 16425us; 65535us; 65535us; 65535us; 65535us; 16427us; 65535us; 16428us; 65535us; 65535us; 65535us; 65535us; 65535us; 16431us; 65535us; 16432us; 65535us; 16434us; 16435us; 16436us; 16437us; 16438us; 16439us; 16440us; 16441us; 65535us; 65535us; 16442us; 65535us; 16443us; 65535us; 16444us; 16445us; 65535us; 65535us; 65535us; 16447us; 65535us; 65535us; 16449us; 65535us; 65535us; 16451us; 65535us; 65535us; 16453us; 65535us; 16455us; 16456us; 65535us; 65535us; 16457us; 65535us; 65535us; 16458us; 65535us; 65535us; 16459us; |] +let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 1us; 65535us; 10us; 11us; 1us; 65535us; 15us; 16us; 1us; 65535us; 4us; 5us; 1us; 65535us; 6us; 7us; 1us; 65535us; 24us; 25us; 2us; 65535us; 24us; 30us; 31us; 32us; 2us; 65535us; 8us; 9us; 52us; 53us; 1us; 65535us; 43us; 44us; 2us; 65535us; 8us; 42us; 52us; 42us; 1us; 65535us; 42us; 43us; 1us; 65535us; 42us; 62us; 2us; 65535us; 42us; 66us; 64us; 67us; 2us; 65535us; 44us; 45us; 86us; 87us; 2us; 65535us; 44us; 86us; 86us; 86us; 4us; 65535us; 90us; 91us; 94us; 95us; 98us; 99us; 101us; 102us; 6us; 65535us; 103us; 104us; 108us; 109us; 110us; 111us; 116us; 117us; 118us; 119us; 120us; 121us; 1us; 65535us; 45us; 46us; 2us; 65535us; 105us; 106us; 113us; 114us; 16us; 65535us; 15us; 19us; 20us; 21us; 42us; 63us; 56us; 57us; 64us; 65us; 103us; 105us; 106us; 107us; 108us; 105us; 110us; 105us; 114us; 115us; 116us; 105us; 118us; 105us; 120us; 105us; 153us; 154us; 156us; 157us; 159us; 160us; 1us; 65535us; 46us; 47us; 2us; 65535us; 139us; 140us; 142us; 143us; 1us; 65535us; 47us; 48us; 2us; 65535us; 145us; 146us; 148us; 149us; 2us; 65535us; 145us; 147us; 148us; 147us; 9us; 65535us; 42us; 68us; 64us; 69us; 103us; 113us; 106us; 112us; 108us; 113us; 110us; 113us; 116us; 113us; 118us; 113us; 120us; 113us; |] +let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 7us; 9us; 11us; 13us; 15us; 18us; 21us; 23us; 26us; 28us; 30us; 33us; 36us; 39us; 44us; 51us; 53us; 56us; 73us; 75us; 78us; 80us; 83us; 86us; |] +let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 2us; 1us; 3us; 1us; 3us; 1us; 4us; 1us; 4us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 1us; 6us; 2us; 6us; 8us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 9us; 2us; 9us; 12us; 1us; 9us; 1us; 9us; 1us; 10us; 1us; 10us; 1us; 11us; 1us; 12us; 1us; 12us; 1us; 13us; 1us; 13us; 1us; 14us; 1us; 14us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 3us; 17us; 18us; 19us; 1us; 17us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 20us; 1us; 20us; 1us; 22us; 4us; 23us; 25us; 27us; 29us; 1us; 24us; 3us; 25us; 27us; 29us; 1us; 25us; 1us; 26us; 1us; 27us; 1us; 28us; 1us; 29us; 1us; 30us; 1us; 30us; 1us; 30us; 1us; 30us; 1us; 31us; 1us; 31us; 1us; 31us; 1us; 31us; 1us; 32us; 1us; 32us; 1us; 32us; 1us; 32us; 1us; 33us; 1us; 33us; 1us; 33us; 1us; 33us; 2us; 35us; 36us; 1us; 36us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 40us; 1us; 40us; 1us; 40us; 1us; 42us; 1us; 42us; 5us; 43us; 44us; 45us; 46us; 48us; 5us; 43us; 44us; 45us; 46us; 48us; 3us; 43us; 44us; 45us; 1us; 44us; 1us; 44us; 1us; 45us; 1us; 45us; 2us; 46us; 48us; 2us; 47us; 49us; 2us; 47us; 49us; 2us; 47us; 49us; 1us; 48us; 1us; 48us; 1us; 49us; 1us; 49us; 1us; 51us; 1us; 51us; 1us; 52us; 1us; 53us; 1us; 54us; 1us; 55us; 1us; 56us; 1us; 57us; 1us; 58us; 3us; 59us; 60us; 61us; 1us; 59us; 1us; 59us; 1us; 60us; 1us; 60us; 1us; 61us; 1us; 61us; 1us; 62us; 4us; 62us; 74us; 75us; 76us; 1us; 64us; 1us; 64us; 1us; 64us; 2us; 65us; 66us; 1us; 66us; 1us; 66us; 1us; 68us; 1us; 68us; 1us; 68us; 2us; 69us; 70us; 1us; 70us; 1us; 70us; 3us; 71us; 72us; 73us; 1us; 72us; 1us; 73us; 3us; 74us; 75us; 76us; 3us; 74us; 75us; 76us; 1us; 74us; 2us; 75us; 76us; 2us; 75us; 76us; 1us; 75us; 1us; 76us; 1us; 76us; 1us; 76us; |] +let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 8us; 10us; 12us; 14us; 16us; 18us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 35us; 37us; 39us; 41us; 43us; 45us; 47us; 49us; 51us; 54us; 56us; 58us; 60us; 62us; 64us; 66us; 68us; 70us; 72us; 74us; 76us; 78us; 80us; 82us; 84us; 86us; 88us; 90us; 92us; 94us; 96us; 98us; 100us; 104us; 106us; 108us; 110us; 112us; 114us; 116us; 118us; 120us; 122us; 124us; 126us; 128us; 133us; 135us; 139us; 141us; 143us; 145us; 147us; 149us; 151us; 153us; 155us; 157us; 159us; 161us; 163us; 165us; 167us; 169us; 171us; 173us; 175us; 177us; 179us; 181us; 184us; 186us; 188us; 190us; 192us; 194us; 196us; 198us; 200us; 202us; 204us; 206us; 208us; 210us; 212us; 214us; 216us; 218us; 220us; 226us; 232us; 236us; 238us; 240us; 242us; 244us; 247us; 250us; 253us; 256us; 258us; 260us; 262us; 264us; 266us; 268us; 270us; 272us; 274us; 276us; 278us; 280us; 282us; 286us; 288us; 290us; 292us; 294us; 296us; 298us; 300us; 305us; 307us; 309us; 311us; 314us; 316us; 318us; 320us; 322us; 324us; 327us; 329us; 331us; 335us; 337us; 339us; 343us; 347us; 349us; 352us; 355us; 357us; 359us; 361us; |] +let _fsyacc_action_rows = 162 +let _fsyacc_actionTableElements = [|4us; 32768us; 10us; 10us; 14us; 6us; 15us; 4us; 23us; 8us; 0us; 49152us; 1us; 32768us; 4us; 3us; 0us; 16385us; 1us; 32768us; 13us; 22us; 0us; 16386us; 1us; 32768us; 13us; 28us; 0us; 16387us; 1us; 16405us; 0us; 59us; 0us; 16388us; 1us; 32768us; 9us; 12us; 0us; 16389us; 1us; 32768us; 45us; 13us; 1us; 32768us; 8us; 14us; 1us; 32768us; 12us; 15us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 2us; 32768us; 11us; 17us; 39us; 20us; 1us; 32768us; 4us; 18us; 0us; 16390us; 0us; 16391us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 0us; 16392us; 1us; 32768us; 45us; 23us; 1us; 32768us; 12us; 24us; 3us; 32768us; 5us; 33us; 6us; 35us; 7us; 37us; 2us; 32768us; 11us; 26us; 39us; 31us; 1us; 32768us; 4us; 27us; 0us; 16393us; 1us; 32768us; 45us; 29us; 0us; 16394us; 0us; 16395us; 3us; 32768us; 5us; 33us; 6us; 35us; 7us; 37us; 0us; 16396us; 1us; 32768us; 45us; 34us; 0us; 16397us; 1us; 32768us; 45us; 36us; 0us; 16398us; 1us; 32768us; 12us; 38us; 1us; 32768us; 44us; 39us; 1us; 32768us; 11us; 40us; 1us; 32768us; 45us; 41us; 0us; 16399us; 9us; 32768us; 2us; 61us; 3us; 129us; 19us; 70us; 20us; 74us; 21us; 78us; 22us; 82us; 43us; 128us; 44us; 127us; 45us; 137us; 1us; 32768us; 24us; 49us; 4us; 16418us; 29us; 100us; 30us; 88us; 31us; 92us; 32us; 96us; 1us; 16434us; 25us; 120us; 1us; 16447us; 28us; 138us; 1us; 16451us; 26us; 144us; 0us; 16400us; 3us; 32768us; 1us; 55us; 12us; 51us; 45us; 50us; 0us; 16401us; 1us; 32768us; 23us; 52us; 1us; 16405us; 0us; 59us; 1us; 32768us; 11us; 54us; 0us; 16402us; 1us; 32768us; 12us; 56us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 1us; 32768us; 11us; 58us; 0us; 16403us; 1us; 32768us; 44us; 60us; 0us; 16404us; 0us; 16406us; 1us; 16407us; 39us; 64us; 0us; 16408us; 8us; 32768us; 3us; 129us; 19us; 70us; 20us; 74us; 21us; 78us; 22us; 82us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16409us; 0us; 16410us; 0us; 16411us; 0us; 16412us; 0us; 16413us; 1us; 32768us; 12us; 71us; 1us; 32768us; 45us; 72us; 1us; 32768us; 11us; 73us; 0us; 16414us; 1us; 32768us; 12us; 75us; 1us; 32768us; 45us; 76us; 1us; 32768us; 11us; 77us; 0us; 16415us; 1us; 32768us; 12us; 79us; 1us; 32768us; 45us; 80us; 1us; 32768us; 11us; 81us; 0us; 16416us; 1us; 32768us; 12us; 83us; 1us; 32768us; 45us; 84us; 1us; 32768us; 11us; 85us; 0us; 16417us; 4us; 16418us; 29us; 100us; 30us; 88us; 31us; 92us; 32us; 96us; 0us; 16420us; 1us; 32768us; 29us; 89us; 1us; 32768us; 45us; 90us; 1us; 16425us; 33us; 103us; 0us; 16421us; 1us; 32768us; 29us; 93us; 1us; 32768us; 45us; 94us; 1us; 16425us; 33us; 103us; 0us; 16422us; 1us; 32768us; 29us; 97us; 1us; 32768us; 45us; 98us; 1us; 16425us; 33us; 103us; 0us; 16423us; 1us; 32768us; 45us; 101us; 1us; 16425us; 33us; 103us; 0us; 16424us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16426us; 5us; 32768us; 34us; 122us; 35us; 123us; 36us; 124us; 37us; 125us; 38us; 126us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 2us; 16427us; 40us; 108us; 41us; 110us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16428us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16429us; 1us; 16430us; 40us; 116us; 5us; 32768us; 34us; 122us; 35us; 123us; 36us; 124us; 37us; 125us; 38us; 126us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 1us; 16431us; 41us; 118us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16432us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16433us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 137us; 0us; 16435us; 0us; 16436us; 0us; 16437us; 0us; 16438us; 0us; 16439us; 0us; 16440us; 0us; 16441us; 0us; 16442us; 3us; 32768us; 43us; 132us; 44us; 134us; 45us; 130us; 1us; 32768us; 3us; 131us; 0us; 16443us; 1us; 32768us; 3us; 133us; 0us; 16444us; 1us; 32768us; 3us; 135us; 0us; 16445us; 0us; 16446us; 1us; 16446us; 12us; 153us; 1us; 32768us; 27us; 139us; 1us; 32768us; 45us; 141us; 0us; 16448us; 1us; 16449us; 39us; 142us; 1us; 32768us; 45us; 141us; 0us; 16450us; 1us; 32768us; 27us; 145us; 1us; 32768us; 45us; 150us; 0us; 16452us; 1us; 16453us; 39us; 148us; 1us; 32768us; 45us; 150us; 0us; 16454us; 2us; 16455us; 16us; 151us; 17us; 152us; 0us; 16456us; 0us; 16457us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 2us; 32768us; 11us; 155us; 39us; 156us; 0us; 16458us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 2us; 32768us; 11us; 158us; 39us; 159us; 0us; 16459us; 4us; 32768us; 3us; 129us; 43us; 128us; 44us; 127us; 45us; 136us; 1us; 32768us; 11us; 161us; 0us; 16460us; |] +let _fsyacc_actionTableRowOffsets = [|0us; 5us; 6us; 8us; 9us; 11us; 12us; 14us; 15us; 17us; 18us; 20us; 21us; 23us; 25us; 27us; 32us; 35us; 37us; 38us; 39us; 44us; 45us; 47us; 49us; 53us; 56us; 58us; 59us; 61us; 62us; 63us; 67us; 68us; 70us; 71us; 73us; 74us; 76us; 78us; 80us; 82us; 83us; 93us; 95us; 100us; 102us; 104us; 106us; 107us; 111us; 112us; 114us; 116us; 118us; 119us; 121us; 126us; 128us; 129us; 131us; 132us; 133us; 135us; 136us; 145us; 146us; 147us; 148us; 149us; 150us; 152us; 154us; 156us; 157us; 159us; 161us; 163us; 164us; 166us; 168us; 170us; 171us; 173us; 175us; 177us; 178us; 183us; 184us; 186us; 188us; 190us; 191us; 193us; 195us; 197us; 198us; 200us; 202us; 204us; 205us; 207us; 209us; 210us; 215us; 216us; 222us; 227us; 230us; 235us; 236us; 241us; 242us; 244us; 250us; 255us; 257us; 262us; 263us; 268us; 269us; 274us; 275us; 276us; 277us; 278us; 279us; 280us; 281us; 282us; 286us; 288us; 289us; 291us; 292us; 294us; 295us; 296us; 298us; 300us; 302us; 303us; 305us; 307us; 308us; 310us; 312us; 313us; 315us; 317us; 318us; 321us; 322us; 323us; 328us; 331us; 332us; 337us; 340us; 341us; 346us; 348us; |] +let _fsyacc_reductionSymbolCounts = [|1us; 2us; 2us; 2us; 2us; 2us; 7us; 1us; 3us; 6us; 2us; 1us; 3us; 2us; 2us; 5us; 7us; 2us; 5us; 5us; 2us; 0us; 1us; 1us; 1us; 3us; 1us; 3us; 1us; 3us; 4us; 4us; 4us; 4us; 0us; 1us; 2us; 4us; 4us; 4us; 3us; 0us; 2us; 3us; 5us; 5us; 3us; 3us; 5us; 5us; 0us; 2us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 3us; 3us; 3us; 1us; 0us; 3us; 1us; 3us; 0us; 3us; 1us; 3us; 1us; 2us; 2us; 4us; 6us; 8us; |] +let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 2us; 2us; 3us; 4us; 4us; 5us; 6us; 7us; 7us; 8us; 8us; 8us; 9us; 10us; 10us; 10us; 11us; 11us; 12us; 12us; 13us; 13us; 13us; 13us; 13us; 13us; 14us; 14us; 14us; 14us; 15us; 15us; 15us; 16us; 16us; 16us; 16us; 17us; 17us; 18us; 18us; 18us; 18us; 18us; 18us; 18us; 19us; 19us; 20us; 20us; 20us; 20us; 20us; 21us; 21us; 21us; 21us; 21us; 21us; 22us; 22us; 23us; 23us; 24us; 24us; 25us; 25us; 26us; 26us; 26us; 27us; 27us; 27us; |] +let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 16385us; 65535us; 16386us; 65535us; 16387us; 65535us; 16388us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16390us; 16391us; 65535us; 16392us; 65535us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 16394us; 16395us; 65535us; 16396us; 65535us; 16397us; 65535us; 16398us; 65535us; 65535us; 65535us; 65535us; 16399us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16400us; 65535us; 16401us; 65535us; 65535us; 65535us; 16402us; 65535us; 65535us; 65535us; 16403us; 65535us; 16404us; 16406us; 65535us; 16408us; 65535us; 16409us; 16410us; 16411us; 16412us; 16413us; 65535us; 65535us; 65535us; 16414us; 65535us; 65535us; 65535us; 16415us; 65535us; 65535us; 65535us; 16416us; 65535us; 65535us; 65535us; 16417us; 65535us; 16420us; 65535us; 65535us; 65535us; 16421us; 65535us; 65535us; 65535us; 16422us; 65535us; 65535us; 65535us; 16423us; 65535us; 65535us; 16424us; 65535us; 16426us; 65535us; 65535us; 65535us; 65535us; 16428us; 65535us; 16429us; 65535us; 65535us; 65535us; 65535us; 65535us; 16432us; 65535us; 16433us; 65535us; 16435us; 16436us; 16437us; 16438us; 16439us; 16440us; 16441us; 16442us; 65535us; 65535us; 16443us; 65535us; 16444us; 65535us; 16445us; 16446us; 65535us; 65535us; 65535us; 16448us; 65535us; 65535us; 16450us; 65535us; 65535us; 16452us; 65535us; 65535us; 16454us; 65535us; 16456us; 16457us; 65535us; 65535us; 16458us; 65535us; 65535us; 16459us; 65535us; 65535us; 16460us; |] let _fsyacc_reductions () = [| -# 431 "SqlParser.fs" +# 438 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> Sql.DmlDdlSqlStatement in Microsoft.FSharp.Core.Operators.box @@ -437,69 +444,69 @@ let _fsyacc_reductions () = [| raise (FSharp.Text.Parsing.Accept(Microsoft.FSharp.Core.Operators.box _1)) ) : 'gentype__startstartCT)); -# 440 "SqlParser.fs" +# 447 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_StatementType in Microsoft.FSharp.Core.Operators.box ( ( -# 38 "SqlParser.fsp" +# 39 "SqlParser.fsp" _1 ) -# 38 "SqlParser.fsp" +# 39 "SqlParser.fsp" : Sql.DmlDdlSqlStatement)); -# 451 "SqlParser.fs" +# 458 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_CreateStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 41 "SqlParser.fsp" +# 42 "SqlParser.fsp" Create(_2) ) -# 41 "SqlParser.fsp" +# 42 "SqlParser.fsp" : 'gentype_StatementType)); -# 462 "SqlParser.fs" +# 469 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_DropStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 42 "SqlParser.fsp" +# 43 "SqlParser.fsp" Drop(_2) ) -# 42 "SqlParser.fsp" +# 43 "SqlParser.fsp" : 'gentype_StatementType)); -# 473 "SqlParser.fs" +# 480 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_SelectStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 43 "SqlParser.fsp" +# 44 "SqlParser.fsp" Select(_2) ) -# 43 "SqlParser.fsp" +# 44 "SqlParser.fsp" : 'gentype_StatementType)); -# 484 "SqlParser.fs" +# 491 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_InsertStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 44 "SqlParser.fsp" +# 45 "SqlParser.fsp" Insert(_2) ) -# 44 "SqlParser.fsp" +# 45 "SqlParser.fsp" : 'gentype_StatementType)); -# 495 "SqlParser.fs" +# 502 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _5 = parseState.GetInput(5) :?> 'gentype_valueList in Microsoft.FSharp.Core.Operators.box ( ( -# 48 "SqlParser.fsp" +# 49 "SqlParser.fsp" { Table = _2; @@ -507,39 +514,39 @@ let _fsyacc_reductions () = [| } ) -# 48 "SqlParser.fsp" +# 49 "SqlParser.fsp" : 'gentype_InsertStatement)); -# 512 "SqlParser.fs" +# 519 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 56 "SqlParser.fsp" +# 57 "SqlParser.fsp" [_1] ) -# 56 "SqlParser.fsp" +# 57 "SqlParser.fsp" : 'gentype_valueList)); -# 523 "SqlParser.fs" +# 530 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_valueList in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 57 "SqlParser.fsp" +# 58 "SqlParser.fsp" _3 :: _1 ) -# 57 "SqlParser.fsp" +# 58 "SqlParser.fsp" : 'gentype_valueList)); -# 535 "SqlParser.fs" +# 542 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_columnTypeList in Microsoft.FSharp.Core.Operators.box ( ( -# 61 "SqlParser.fsp" +# 62 "SqlParser.fsp" { Table = _2; @@ -547,77 +554,77 @@ let _fsyacc_reductions () = [| } ) -# 61 "SqlParser.fsp" +# 62 "SqlParser.fsp" : 'gentype_CreateStatement)); -# 552 "SqlParser.fs" +# 559 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 69 "SqlParser.fsp" +# 70 "SqlParser.fsp" _2 ) -# 69 "SqlParser.fsp" +# 70 "SqlParser.fsp" : 'gentype_DropStatement)); -# 563 "SqlParser.fs" +# 570 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnType in Microsoft.FSharp.Core.Operators.box ( ( -# 72 "SqlParser.fsp" +# 73 "SqlParser.fsp" [_1] ) -# 72 "SqlParser.fsp" +# 73 "SqlParser.fsp" : 'gentype_columnTypeList)); -# 574 "SqlParser.fs" +# 581 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnTypeList in let _3 = parseState.GetInput(3) :?> 'gentype_columnType in Microsoft.FSharp.Core.Operators.box ( ( -# 73 "SqlParser.fsp" +# 74 "SqlParser.fsp" _3 :: _1 ) -# 73 "SqlParser.fsp" +# 74 "SqlParser.fsp" : 'gentype_columnTypeList)); -# 586 "SqlParser.fs" +# 593 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 76 "SqlParser.fsp" +# 77 "SqlParser.fsp" IntCType, 0, _2 ) -# 76 "SqlParser.fsp" +# 77 "SqlParser.fsp" : 'gentype_columnType)); -# 597 "SqlParser.fs" +# 604 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 77 "SqlParser.fsp" +# 78 "SqlParser.fsp" DoubleCType, 0, _2 ) -# 77 "SqlParser.fsp" +# 78 "SqlParser.fsp" : 'gentype_columnType)); -# 608 "SqlParser.fs" +# 615 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> int in let _5 = parseState.GetInput(5) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 78 "SqlParser.fsp" +# 79 "SqlParser.fsp" StringCType, _3, _5 ) -# 78 "SqlParser.fsp" +# 79 "SqlParser.fsp" : 'gentype_columnType)); -# 620 "SqlParser.fs" +# 627 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_topClause in let _2 = parseState.GetInput(2) :?> 'gentype_columnSelect in @@ -629,7 +636,7 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 86 "SqlParser.fsp" +# 87 "SqlParser.fsp" { Top = _1 @@ -642,288 +649,299 @@ let _fsyacc_reductions () = [| } ) -# 86 "SqlParser.fsp" +# 87 "SqlParser.fsp" : 'gentype_SelectStatement)); -# 647 "SqlParser.fs" +# 654 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 99 "SqlParser.fsp" +# 100 "SqlParser.fsp" FromTable(_2) ) -# 99 "SqlParser.fsp" +# 100 "SqlParser.fsp" : 'gentype_fromStatement)); -# 658 "SqlParser.fs" +# 665 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _4 = parseState.GetInput(4) :?> 'gentype_SelectStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 100 "SqlParser.fsp" +# 101 "SqlParser.fsp" FromSubquery(_4) ) -# 100 "SqlParser.fsp" +# 101 "SqlParser.fsp" : 'gentype_fromStatement)); -# 669 "SqlParser.fs" +# 676 "SqlParser.fs" + (fun (parseState : FSharp.Text.Parsing.IParseState) -> + let _4 = parseState.GetInput(4) :?> 'gentype_value in + Microsoft.FSharp.Core.Operators.box + ( + ( +# 102 "SqlParser.fsp" + FileSystemProvider(_4) + ) +# 102 "SqlParser.fsp" + : 'gentype_fromStatement)); +# 687 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 103 "SqlParser.fsp" +# 105 "SqlParser.fsp" Some(_2) ) -# 103 "SqlParser.fsp" +# 105 "SqlParser.fsp" : 'gentype_topClause)); -# 680 "SqlParser.fs" +# 698 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 104 "SqlParser.fsp" +# 106 "SqlParser.fsp" None ) -# 104 "SqlParser.fsp" +# 106 "SqlParser.fsp" : 'gentype_topClause)); -# 690 "SqlParser.fs" +# 708 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 107 "SqlParser.fsp" +# 109 "SqlParser.fsp" Star ) -# 107 "SqlParser.fsp" +# 109 "SqlParser.fsp" : 'gentype_columnSelect)); -# 700 "SqlParser.fs" +# 718 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in Microsoft.FSharp.Core.Operators.box ( ( -# 108 "SqlParser.fsp" +# 110 "SqlParser.fsp" ColumnList(List.rev _1) ) -# 108 "SqlParser.fsp" +# 110 "SqlParser.fsp" : 'gentype_columnSelect)); -# 711 "SqlParser.fs" +# 729 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 111 "SqlParser.fsp" +# 113 "SqlParser.fsp" [ValueOrFunc(Value(_1))] ) -# 111 "SqlParser.fsp" +# 113 "SqlParser.fsp" : 'gentype_columnList)); -# 722 "SqlParser.fs" +# 740 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 112 "SqlParser.fsp" +# 114 "SqlParser.fsp" ValueOrFunc(Value(_3)) :: _1 ) -# 112 "SqlParser.fsp" +# 114 "SqlParser.fsp" : 'gentype_columnList)); -# 734 "SqlParser.fs" +# 752 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_aggregate in Microsoft.FSharp.Core.Operators.box ( ( -# 113 "SqlParser.fsp" +# 115 "SqlParser.fsp" [_1] ) -# 113 "SqlParser.fsp" +# 115 "SqlParser.fsp" : 'gentype_columnList)); -# 745 "SqlParser.fs" +# 763 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_aggregate in Microsoft.FSharp.Core.Operators.box ( ( -# 114 "SqlParser.fsp" +# 116 "SqlParser.fsp" _3 :: _1 ) -# 114 "SqlParser.fsp" +# 116 "SqlParser.fsp" : 'gentype_columnList)); -# 757 "SqlParser.fs" +# 775 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in Microsoft.FSharp.Core.Operators.box ( ( -# 115 "SqlParser.fsp" +# 117 "SqlParser.fsp" [ValueOrFunc(FuncCall(_1))] ) -# 115 "SqlParser.fsp" +# 117 "SqlParser.fsp" : 'gentype_columnList)); -# 768 "SqlParser.fs" +# 786 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_funcCall in Microsoft.FSharp.Core.Operators.box ( ( -# 116 "SqlParser.fsp" +# 118 "SqlParser.fsp" ValueOrFunc(FuncCall(_3)) :: _1 ) -# 116 "SqlParser.fsp" +# 118 "SqlParser.fsp" : 'gentype_columnList)); -# 780 "SqlParser.fs" +# 798 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 119 "SqlParser.fsp" +# 121 "SqlParser.fsp" Aggregate(Max, _3) ) -# 119 "SqlParser.fsp" +# 121 "SqlParser.fsp" : 'gentype_aggregate)); -# 791 "SqlParser.fs" +# 809 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 120 "SqlParser.fsp" +# 122 "SqlParser.fsp" Aggregate(Min, _3) ) -# 120 "SqlParser.fsp" +# 122 "SqlParser.fsp" : 'gentype_aggregate)); -# 802 "SqlParser.fs" +# 820 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 121 "SqlParser.fsp" +# 123 "SqlParser.fsp" Aggregate(Count, _3) ) -# 121 "SqlParser.fsp" +# 123 "SqlParser.fsp" : 'gentype_aggregate)); -# 813 "SqlParser.fs" +# 831 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 122 "SqlParser.fsp" +# 124 "SqlParser.fsp" Aggregate(Sum, _3) ) -# 122 "SqlParser.fsp" +# 124 "SqlParser.fsp" : 'gentype_aggregate)); -# 824 "SqlParser.fs" +# 842 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 126 "SqlParser.fsp" +# 128 "SqlParser.fsp" [] ) -# 126 "SqlParser.fsp" +# 128 "SqlParser.fsp" : 'gentype_joinList)); -# 834 "SqlParser.fs" +# 852 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_joinClause in Microsoft.FSharp.Core.Operators.box ( ( -# 127 "SqlParser.fsp" +# 129 "SqlParser.fsp" [_1] ) -# 127 "SqlParser.fsp" +# 129 "SqlParser.fsp" : 'gentype_joinList)); -# 845 "SqlParser.fs" +# 863 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_joinClause in let _2 = parseState.GetInput(2) :?> 'gentype_joinList in Microsoft.FSharp.Core.Operators.box ( ( -# 128 "SqlParser.fsp" +# 130 "SqlParser.fsp" _1 :: _2 ) -# 128 "SqlParser.fsp" +# 130 "SqlParser.fsp" : 'gentype_joinList)); -# 857 "SqlParser.fs" +# 875 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 131 "SqlParser.fsp" +# 133 "SqlParser.fsp" _3, Inner, _4 ) -# 131 "SqlParser.fsp" +# 133 "SqlParser.fsp" : 'gentype_joinClause)); -# 869 "SqlParser.fs" +# 887 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 132 "SqlParser.fsp" +# 134 "SqlParser.fsp" _3, Left, _4 ) -# 132 "SqlParser.fsp" +# 134 "SqlParser.fsp" : 'gentype_joinClause)); -# 881 "SqlParser.fs" +# 899 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 133 "SqlParser.fsp" +# 135 "SqlParser.fsp" _3, Right, _4 ) -# 133 "SqlParser.fsp" +# 135 "SqlParser.fsp" : 'gentype_joinClause)); -# 893 "SqlParser.fs" +# 911 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 134 "SqlParser.fsp" +# 136 "SqlParser.fsp" _2, Inner, _3 ) -# 134 "SqlParser.fsp" +# 136 "SqlParser.fsp" : 'gentype_joinClause)); -# 905 "SqlParser.fs" +# 923 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 137 "SqlParser.fsp" +# 139 "SqlParser.fsp" None ) -# 137 "SqlParser.fsp" +# 139 "SqlParser.fsp" : 'gentype_joinOnClause)); -# 915 "SqlParser.fs" +# 933 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_conditionList in Microsoft.FSharp.Core.Operators.box ( ( -# 138 "SqlParser.fsp" +# 140 "SqlParser.fsp" Some(_2) ) -# 138 "SqlParser.fsp" +# 140 "SqlParser.fsp" : 'gentype_joinOnClause)); -# 926 "SqlParser.fs" +# 944 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -931,12 +949,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 141 "SqlParser.fsp" +# 143 "SqlParser.fsp" Cond(Value(_1), _2, Value(_3)) ) -# 141 "SqlParser.fsp" +# 143 "SqlParser.fsp" : 'gentype_conditionList)); -# 939 "SqlParser.fs" +# 957 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -945,12 +963,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 142 "SqlParser.fsp" +# 144 "SqlParser.fsp" And(Cond(Value(_1), _2, Value(_3)), _5) ) -# 142 "SqlParser.fsp" +# 144 "SqlParser.fsp" : 'gentype_conditionList)); -# 953 "SqlParser.fs" +# 971 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -959,12 +977,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 143 "SqlParser.fsp" +# 145 "SqlParser.fsp" Or(Cond(Value(_1), _2, Value(_3)), _5) ) -# 143 "SqlParser.fsp" +# 145 "SqlParser.fsp" : 'gentype_conditionList)); -# 967 "SqlParser.fs" +# 985 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -972,12 +990,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 144 "SqlParser.fsp" +# 146 "SqlParser.fsp" Cond(Value(_1), _2, FuncCall(_3)) ) -# 144 "SqlParser.fsp" +# 146 "SqlParser.fsp" : 'gentype_conditionList)); -# 980 "SqlParser.fs" +# 998 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -985,12 +1003,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 145 "SqlParser.fsp" +# 147 "SqlParser.fsp" Cond(FuncCall(_1), _2, Value(_3)) ) -# 145 "SqlParser.fsp" +# 147 "SqlParser.fsp" : 'gentype_conditionList)); -# 993 "SqlParser.fs" +# 1011 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -999,12 +1017,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 146 "SqlParser.fsp" +# 148 "SqlParser.fsp" And(Cond(Value(_1), _2, FuncCall(_3)), _5) ) -# 146 "SqlParser.fsp" +# 148 "SqlParser.fsp" : 'gentype_conditionList)); -# 1007 "SqlParser.fs" +# 1025 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1013,282 +1031,282 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 147 "SqlParser.fsp" +# 149 "SqlParser.fsp" Or(Cond(FuncCall(_1), _2, Value(_3)), _5) ) -# 147 "SqlParser.fsp" +# 149 "SqlParser.fsp" : 'gentype_conditionList)); -# 1021 "SqlParser.fs" +# 1039 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 151 "SqlParser.fsp" +# 153 "SqlParser.fsp" None ) -# 151 "SqlParser.fsp" +# 153 "SqlParser.fsp" : 'gentype_whereClause)); -# 1031 "SqlParser.fs" +# 1049 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_conditionList in Microsoft.FSharp.Core.Operators.box ( ( -# 152 "SqlParser.fsp" +# 154 "SqlParser.fsp" Some(_2) ) -# 152 "SqlParser.fsp" +# 154 "SqlParser.fsp" : 'gentype_whereClause)); -# 1042 "SqlParser.fs" +# 1060 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" Eq ) -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_op)); -# 1052 "SqlParser.fs" +# 1070 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" Lt ) -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_op)); -# 1062 "SqlParser.fs" +# 1080 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" Le ) -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_op)); -# 1072 "SqlParser.fs" +# 1090 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" Gt ) -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_op)); -# 1082 "SqlParser.fs" +# 1100 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" Ge ) -# 154 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_op)); -# 1092 "SqlParser.fs" +# 1110 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 157 "SqlParser.fsp" +# 159 "SqlParser.fsp" Int(_1) ) -# 157 "SqlParser.fsp" +# 159 "SqlParser.fsp" : 'gentype_value)); -# 1103 "SqlParser.fs" +# 1121 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> float in Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 160 "SqlParser.fsp" Float(_1) ) -# 158 "SqlParser.fsp" +# 160 "SqlParser.fsp" : 'gentype_value)); -# 1114 "SqlParser.fs" +# 1132 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 159 "SqlParser.fsp" +# 161 "SqlParser.fsp" String(_2) ) -# 159 "SqlParser.fsp" +# 161 "SqlParser.fsp" : 'gentype_value)); -# 1125 "SqlParser.fs" +# 1143 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> float in Microsoft.FSharp.Core.Operators.box ( ( -# 160 "SqlParser.fsp" +# 162 "SqlParser.fsp" String(string _2) ) -# 160 "SqlParser.fsp" +# 162 "SqlParser.fsp" : 'gentype_value)); -# 1136 "SqlParser.fs" +# 1154 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 161 "SqlParser.fsp" +# 163 "SqlParser.fsp" String(string _2) ) -# 161 "SqlParser.fsp" +# 163 "SqlParser.fsp" : 'gentype_value)); -# 1147 "SqlParser.fs" +# 1165 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 162 "SqlParser.fsp" +# 164 "SqlParser.fsp" Id(_1) ) -# 162 "SqlParser.fsp" +# 164 "SqlParser.fsp" : 'gentype_value)); -# 1158 "SqlParser.fs" +# 1176 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 166 "SqlParser.fsp" +# 168 "SqlParser.fsp" [] ) -# 166 "SqlParser.fsp" +# 168 "SqlParser.fsp" : 'gentype_groupByClause)); -# 1168 "SqlParser.fs" +# 1186 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> 'gentype_groupByList in Microsoft.FSharp.Core.Operators.box ( ( -# 167 "SqlParser.fsp" +# 169 "SqlParser.fsp" _3 ) -# 167 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_groupByClause)); -# 1179 "SqlParser.fs" +# 1197 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 170 "SqlParser.fsp" +# 172 "SqlParser.fsp" [_1] ) -# 170 "SqlParser.fsp" +# 172 "SqlParser.fsp" : 'gentype_groupByList)); -# 1190 "SqlParser.fs" +# 1208 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_groupByList in Microsoft.FSharp.Core.Operators.box ( ( -# 171 "SqlParser.fsp" +# 173 "SqlParser.fsp" _1 :: _3 ) -# 171 "SqlParser.fsp" +# 173 "SqlParser.fsp" : 'gentype_groupByList)); -# 1202 "SqlParser.fs" +# 1220 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 175 "SqlParser.fsp" +# 177 "SqlParser.fsp" [] ) -# 175 "SqlParser.fsp" +# 177 "SqlParser.fsp" : 'gentype_orderByClause)); -# 1212 "SqlParser.fs" +# 1230 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> 'gentype_orderByList in Microsoft.FSharp.Core.Operators.box ( ( -# 176 "SqlParser.fsp" +# 178 "SqlParser.fsp" _3 ) -# 176 "SqlParser.fsp" +# 178 "SqlParser.fsp" : 'gentype_orderByClause)); -# 1223 "SqlParser.fs" +# 1241 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_orderBy in Microsoft.FSharp.Core.Operators.box ( ( -# 179 "SqlParser.fsp" +# 181 "SqlParser.fsp" [_1] ) -# 179 "SqlParser.fsp" +# 181 "SqlParser.fsp" : 'gentype_orderByList)); -# 1234 "SqlParser.fs" +# 1252 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_orderBy in let _3 = parseState.GetInput(3) :?> 'gentype_orderByList in Microsoft.FSharp.Core.Operators.box ( ( -# 180 "SqlParser.fsp" +# 182 "SqlParser.fsp" _1 :: _3 ) -# 180 "SqlParser.fsp" +# 182 "SqlParser.fsp" : 'gentype_orderByList)); -# 1246 "SqlParser.fs" +# 1264 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 183 "SqlParser.fsp" +# 185 "SqlParser.fsp" _1, Asc ) -# 183 "SqlParser.fsp" +# 185 "SqlParser.fsp" : 'gentype_orderBy)); -# 1257 "SqlParser.fs" +# 1275 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 184 "SqlParser.fsp" +# 186 "SqlParser.fsp" _1, Asc ) -# 184 "SqlParser.fsp" +# 186 "SqlParser.fsp" : 'gentype_orderBy)); -# 1268 "SqlParser.fs" +# 1286 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 185 "SqlParser.fsp" +# 187 "SqlParser.fsp" _1, Desc ) -# 185 "SqlParser.fsp" +# 187 "SqlParser.fsp" : 'gentype_orderBy)); -# 1279 "SqlParser.fs" +# 1297 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 188 "SqlParser.fsp" +# 190 "SqlParser.fsp" (_1, Args1(_3)) ) -# 188 "SqlParser.fsp" +# 190 "SqlParser.fsp" : 'gentype_funcCall)); -# 1291 "SqlParser.fs" +# 1309 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in @@ -1296,12 +1314,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 189 "SqlParser.fsp" +# 191 "SqlParser.fsp" (_1, Args2(_3, _5)) ) -# 189 "SqlParser.fsp" +# 191 "SqlParser.fsp" : 'gentype_funcCall)); -# 1304 "SqlParser.fs" +# 1322 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in @@ -1310,13 +1328,13 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 190 "SqlParser.fsp" +# 192 "SqlParser.fsp" (_1, Args3(_3, _5, _7)) ) -# 190 "SqlParser.fsp" +# 192 "SqlParser.fsp" : 'gentype_funcCall)); |] -# 1319 "SqlParser.fs" +# 1337 "SqlParser.fs" let tables : FSharp.Text.Parsing.Tables<_> = { reductions= _fsyacc_reductions (); endOfInputTag = _fsyacc_endOfInputTag; @@ -1335,7 +1353,7 @@ let tables : FSharp.Text.Parsing.Tables<_> = match parse_error_rich with | Some f -> f ctxt | None -> parse_error ctxt.Message); - numTerminals = 48; + numTerminals = 49; productionToNonTerminalTable = _fsyacc_productionToNonTerminalTable } let engine lexer lexbuf startState = tables.Interpret(lexer, lexbuf, startState) let startCT lexer lexbuf : Sql.DmlDdlSqlStatement = diff --git a/ParserLexerFSharp/SqlParser.fsi b/ParserLexerFSharp/SqlParser.fsi index 58b8c6c..31702a2 100644 --- a/ParserLexerFSharp/SqlParser.fsi +++ b/ParserLexerFSharp/SqlParser.fsi @@ -2,6 +2,7 @@ module SqlParser type token = | TOP + | FILESYSTEM | STAR | QUOT | EOF @@ -48,6 +49,7 @@ type token = | ID of (string) type tokenId = | TOKEN_TOP + | TOKEN_FILESYSTEM | TOKEN_STAR | TOKEN_QUOT | TOKEN_EOF diff --git a/ParserLexerFSharp/SqlParser.fsp b/ParserLexerFSharp/SqlParser.fsp index 24302ae..d8144fc 100644 --- a/ParserLexerFSharp/SqlParser.fsp +++ b/ParserLexerFSharp/SqlParser.fsp @@ -27,6 +27,7 @@ open Sql %token EOF %token QUOT %token STAR +%token FILESYSTEM %token TOP %start startCT @@ -98,6 +99,7 @@ SelectStatement: topClause columnSelect fromStatement: | FROM ID { FromTable($2) } | FROM OBRCK SELECT SelectStatement CBRCK { FromSubquery($4) } + | FROM FILESYSTEM OBRCK value CBRCK { FileSystemProvider($4) } topClause: | TOP INT { Some($2) } diff --git a/QueryProcessing/AggGroupOpBuilder.cs b/QueryProcessing/Builders/AggGroupOpBuilder.cs similarity index 100% rename from QueryProcessing/AggGroupOpBuilder.cs rename to QueryProcessing/Builders/AggGroupOpBuilder.cs diff --git a/QueryProcessing/AstToOpTreeBuilder.cs b/QueryProcessing/Builders/AstToOpTreeBuilder.cs similarity index 100% rename from QueryProcessing/AstToOpTreeBuilder.cs rename to QueryProcessing/Builders/AstToOpTreeBuilder.cs diff --git a/QueryProcessing/FilterStatementBuilder.cs b/QueryProcessing/Builders/FilterStatementBuilder.cs similarity index 100% rename from QueryProcessing/FilterStatementBuilder.cs rename to QueryProcessing/Builders/FilterStatementBuilder.cs diff --git a/QueryProcessing/GroupByStatementBuilder.cs b/QueryProcessing/Builders/GroupByStatementBuilder.cs similarity index 100% rename from QueryProcessing/GroupByStatementBuilder.cs rename to QueryProcessing/Builders/GroupByStatementBuilder.cs diff --git a/QueryProcessing/IStatementTreeBuilder.cs b/QueryProcessing/Builders/IStatementTreeBuilder.cs similarity index 100% rename from QueryProcessing/IStatementTreeBuilder.cs rename to QueryProcessing/Builders/IStatementTreeBuilder.cs diff --git a/QueryProcessing/JoinOpBuilder.cs b/QueryProcessing/Builders/JoinOpBuilder.cs similarity index 100% rename from QueryProcessing/JoinOpBuilder.cs rename to QueryProcessing/Builders/JoinOpBuilder.cs diff --git a/QueryProcessing/OrderByOpBuilder.cs b/QueryProcessing/Builders/OrderByOpBuilder.cs similarity index 100% rename from QueryProcessing/OrderByOpBuilder.cs rename to QueryProcessing/Builders/OrderByOpBuilder.cs diff --git a/QueryProcessing/ProjectOpBuilder.cs b/QueryProcessing/Builders/ProjectOpBuilder.cs similarity index 100% rename from QueryProcessing/ProjectOpBuilder.cs rename to QueryProcessing/Builders/ProjectOpBuilder.cs diff --git a/QueryProcessing/SourceOpBuilder.cs b/QueryProcessing/Builders/SourceOpBuilder.cs similarity index 73% rename from QueryProcessing/SourceOpBuilder.cs rename to QueryProcessing/Builders/SourceOpBuilder.cs index e974f6e..714ca3a 100644 --- a/QueryProcessing/SourceOpBuilder.cs +++ b/QueryProcessing/Builders/SourceOpBuilder.cs @@ -42,6 +42,24 @@ public async Task> BuildStatement(Sql.sqlStatement // Since we currently don't support indexes we can only build scan operation. return new PhyOpScan(table.Collection, tran, table.Columns, table.TableName); } + else if (statement.From.IsFileSystemProvider) + { + Sql.value value = ((Sql.sqlStatementOrId.FileSystemProvider)statement.From).Item; + + if (value.IsId) + { + throw new NotImplementedException("File system scan from ID currently not supported"); + } + + if (value.IsString) + { + value = stringNormalizer.ApplyReplacementTokens(value); + string path = ((Sql.value.String)value).Item; + return new PhyOpFileSystemProvider(path); + } + + throw new ArgumentException("Invalid argument for FROM FILESYSTEM"); + } throw new ArgumentException("Scan can only be done from Table or from Subquery"); } diff --git a/QueryProcessing/FuncCallMapper.cs b/QueryProcessing/Functions/FuncCallMapper.cs similarity index 92% rename from QueryProcessing/FuncCallMapper.cs rename to QueryProcessing/Functions/FuncCallMapper.cs index 84fd156..9cd8450 100644 --- a/QueryProcessing/FuncCallMapper.cs +++ b/QueryProcessing/Functions/FuncCallMapper.cs @@ -87,6 +87,20 @@ private static Func FunctionResultBuilder(Sql.valueOrFun } }; + /// + /// Externally exposed handler for func registration. + /// Use it as part of engine boot to register funcs from external components. + /// + public static void RegisterFunc(string functionName, IFunctionMappingHandler mappingHandler) + { + FuncDictionary.Add(functionName, new MetadataOutputFunctorBuilderPair() + { + GetMetadataInfoForOutput = (func, mds) => mappingHandler.GetMetadataInfoForOutput(func, mds), + FunctorBuilder = (func, output, mds) => FunctionBuilder(func, output, mds, mappingHandler), + FunctionReturnValueBuilder = (func, mds) => FunctionResultBuilder(func, mds, mappingHandler), + }); + } + public static MetadataColumn GetMetadataInfoForOutput(Sql.valueOrFunc.FuncCall func, MetadataColumn[] sourceInput) { string funcName = func.Item.Item1; diff --git a/QueryProcessing/Functions/FunctionArgExtractor.cs b/QueryProcessing/Functions/FunctionArgExtractor.cs index 73d07b8..f18b151 100644 --- a/QueryProcessing/Functions/FunctionArgExtractor.cs +++ b/QueryProcessing/Functions/FunctionArgExtractor.cs @@ -26,6 +26,16 @@ public abstract class FunctionArg2Extractor public C ArgThree; } + public class FunctorArgExtractString : FunctionArg1Extractor + { + public FunctorArgExtractString(RowHolder inputRowHolder, Union2Type[] sourceArgs) + { + this.ArgOne = sourceArgs[0].Match( + (MetadataColumn md) => new string(inputRowHolder.GetStringField(md.ColumnId)), + (Sql.value val) => ((Sql.value.String)val).Item); + } + } + public class FunctorArgExtractIntInt : FunctionArg2Extractor { public FunctorArgExtractIntInt(RowHolder inputRowHolder, Union2Type[] sourceArgs) diff --git a/QueryProcessing/Functions/FunctorArgChecks.cs b/QueryProcessing/Functions/FunctorArgChecks.cs index 34ad7c7..f49f528 100644 --- a/QueryProcessing/Functions/FunctorArgChecks.cs +++ b/QueryProcessing/Functions/FunctorArgChecks.cs @@ -5,7 +5,7 @@ namespace QueryProcessing.Functions { - static class FunctorArgChecks + public static class FunctorArgChecks { public static void CheckInputArguments(Union2Type[] sourceArguments, ColumnType[] acceptedColumnTypes) { diff --git a/QueryProcessing/IFunctionCall.cs b/QueryProcessing/Functions/IFunctionCall.cs similarity index 100% rename from QueryProcessing/IFunctionCall.cs rename to QueryProcessing/Functions/IFunctionCall.cs diff --git a/QueryProcessing/IPhysicalOperator.cs b/QueryProcessing/PhyOperators/IPhysicalOperator.cs similarity index 100% rename from QueryProcessing/IPhysicalOperator.cs rename to QueryProcessing/PhyOperators/IPhysicalOperator.cs diff --git a/QueryProcessing/PhyOperators/PhyOpFileSystemProvider.cs b/QueryProcessing/PhyOperators/PhyOpFileSystemProvider.cs new file mode 100644 index 0000000..cba5015 --- /dev/null +++ b/QueryProcessing/PhyOperators/PhyOpFileSystemProvider.cs @@ -0,0 +1,78 @@ +using MetadataManager; +using PageManager; +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; + +namespace QueryProcessing +{ + public class PhyOpFileSystemProvider : IPhysicalOperator + { + private readonly string sourcePath; + const int MaxPathLength = 256; + const int ExtensionLength = 4; + + public PhyOpFileSystemProvider(string sourcePath) + { + this.sourcePath = sourcePath; + } + + public MetadataColumn[] GetOutputColumns() + { + return new MetadataColumn[] + { + new MetadataColumn(0, 0, "FilePath", new ColumnInfo(ColumnType.String, MaxPathLength)), + new MetadataColumn(1, 0, "FileName", new ColumnInfo(ColumnType.String, MaxPathLength)), + new MetadataColumn(2, 0, "Extension", new ColumnInfo(ColumnType.String, ExtensionLength)), + new MetadataColumn(3, 0, "FileSize", new ColumnInfo(ColumnType.Int)), + }; + } + + public async IAsyncEnumerable Iterate(ITransaction tran) + { + EnumerationOptions options = new EnumerationOptions() + { + IgnoreInaccessible = true, + RecurseSubdirectories = false, + }; + + const string searchPattern = "*.*"; + + foreach (string file in Directory.EnumerateFiles(this.sourcePath, searchPattern, options)) + { + string fullName = Path.GetFullPath(file); + string fileName = Path.GetFileName(fullName); + string extension = Path.GetExtension(fullName); + + if (fullName.Length > MaxPathLength) + { + throw new NotImplementedException("Currently path limit is 256 chars"); + } + + // TODO: Need support for longs. + long length = new FileInfo(fullName).Length; + + if (length > int.MaxValue) + { + throw new NotImplementedException("Currently there is no support for longs"); + } + + RowHolder rh = new RowHolder(new ColumnInfo[] + { + new ColumnInfo(ColumnType.String, MaxPathLength), + new ColumnInfo(ColumnType.String, MaxPathLength), + new ColumnInfo(ColumnType.String, ExtensionLength), + new ColumnInfo(ColumnType.Int), + }); + + rh.SetField(0, fullName.ToCharArray()); + rh.SetField(1, fileName.ToCharArray()); + rh.SetField(2, extension.ToCharArray()); + rh.SetField(3, (int)length); + + yield return await Task.FromResult(rh); + } + } + } +} diff --git a/QueryProcessing/PhyOpFilter.cs b/QueryProcessing/PhyOperators/PhyOpFilter.cs similarity index 100% rename from QueryProcessing/PhyOpFilter.cs rename to QueryProcessing/PhyOperators/PhyOpFilter.cs diff --git a/QueryProcessing/PhyOpGroupBy.cs b/QueryProcessing/PhyOperators/PhyOpGroupBy.cs similarity index 100% rename from QueryProcessing/PhyOpGroupBy.cs rename to QueryProcessing/PhyOperators/PhyOpGroupBy.cs diff --git a/QueryProcessing/PhyOpInsert.cs b/QueryProcessing/PhyOperators/PhyOpInsert.cs similarity index 100% rename from QueryProcessing/PhyOpInsert.cs rename to QueryProcessing/PhyOperators/PhyOpInsert.cs diff --git a/QueryProcessing/PhyOpLoopInnerJoin.cs b/QueryProcessing/PhyOperators/PhyOpLoopInnerJoin.cs similarity index 100% rename from QueryProcessing/PhyOpLoopInnerJoin.cs rename to QueryProcessing/PhyOperators/PhyOpLoopInnerJoin.cs diff --git a/QueryProcessing/PhyOpOrderBy.cs b/QueryProcessing/PhyOperators/PhyOpOrderBy.cs similarity index 100% rename from QueryProcessing/PhyOpOrderBy.cs rename to QueryProcessing/PhyOperators/PhyOpOrderBy.cs diff --git a/QueryProcessing/PhyOpProject.cs b/QueryProcessing/PhyOperators/PhyOpProject.cs similarity index 100% rename from QueryProcessing/PhyOpProject.cs rename to QueryProcessing/PhyOperators/PhyOpProject.cs diff --git a/QueryProcessing/PhyOpScan.cs b/QueryProcessing/PhyOperators/PhyOpScan.cs similarity index 100% rename from QueryProcessing/PhyOpScan.cs rename to QueryProcessing/PhyOperators/PhyOpScan.cs diff --git a/QueryProcessing/PhyOpStaticRowProvider.cs b/QueryProcessing/PhyOperators/PhyOpStaticRowProvider.cs similarity index 100% rename from QueryProcessing/PhyOpStaticRowProvider.cs rename to QueryProcessing/PhyOperators/PhyOpStaticRowProvider.cs diff --git a/QueryProcessing/QueryProcessingAccessors.cs b/QueryProcessing/QueryProcessingAccessors.cs index df368d6..6b52f8f 100644 --- a/QueryProcessing/QueryProcessingAccessors.cs +++ b/QueryProcessing/QueryProcessingAccessors.cs @@ -40,7 +40,7 @@ public static MetadataColumn GetMetadataColumn(string name, MetadataColumn[] met // So just find the column. foreach (MetadataColumn mc in metadataColumns) { - if (mc.ColumnName == name) + if (string.Equals(mc.ColumnName, name, StringComparison.OrdinalIgnoreCase)) { return mc; } @@ -55,7 +55,18 @@ public static MetadataColumn GetMetadataColumn(string name, MetadataColumn[] met MetadataColumn? foundMc = null; foreach (MetadataColumn mc in metadataColumns) { - if (mc.ColumnName.Split('.')[1] == name) + string searchColumnName = mc.ColumnName; + if (searchColumnName.Contains('.')) + { + if (searchColumnName.Count(c => c == '.') != 1) + { + throw new InvalidColumnNameException(); + } + + searchColumnName = searchColumnName.Split('.')[1]; + } + + if (string.Equals(searchColumnName, name, StringComparison.OrdinalIgnoreCase)) { if (foundMc == null) { diff --git a/QueryProcessing/RowHolderOrderByComparer.cs b/QueryProcessing/RowHolderOrderByComparer.cs index a0a4693..d3b5bb8 100644 --- a/QueryProcessing/RowHolderOrderByComparer.cs +++ b/QueryProcessing/RowHolderOrderByComparer.cs @@ -1,7 +1,6 @@ using PageManager; using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; namespace QueryProcessing { diff --git a/QueryProcessing/CreateTableStatement.cs b/QueryProcessing/Statements/CreateTableStatement.cs similarity index 100% rename from QueryProcessing/CreateTableStatement.cs rename to QueryProcessing/Statements/CreateTableStatement.cs diff --git a/QueryProcessing/ISqlStatement.cs b/QueryProcessing/Statements/ISqlStatement.cs similarity index 100% rename from QueryProcessing/ISqlStatement.cs rename to QueryProcessing/Statements/ISqlStatement.cs diff --git a/QueryProcessing/InsertIntoTableStatement.cs b/QueryProcessing/Statements/InsertIntoTableStatement.cs similarity index 100% rename from QueryProcessing/InsertIntoTableStatement.cs rename to QueryProcessing/Statements/InsertIntoTableStatement.cs diff --git a/QueryProcessing/SelectStatement.cs b/QueryProcessing/Statements/SelectStatement.cs similarity index 100% rename from QueryProcessing/SelectStatement.cs rename to QueryProcessing/Statements/SelectStatement.cs diff --git a/QueryProcessing/InputStringNormalizer.cs b/QueryProcessing/Utilities/InputStringNormalizer.cs similarity index 98% rename from QueryProcessing/InputStringNormalizer.cs rename to QueryProcessing/Utilities/InputStringNormalizer.cs index e1f4b01..9947714 100644 --- a/QueryProcessing/InputStringNormalizer.cs +++ b/QueryProcessing/Utilities/InputStringNormalizer.cs @@ -15,7 +15,7 @@ namespace QueryProcessing public class InputStringNormalizer { private Dictionary> replacementDictionary; - private char[] substitutions = new[] { ' ', '.', ',', '(', ')', '\"', '\\', ';', '/' }; + private char[] substitutions = new[] { ' ', '.', ',', '(', ')', '\"', '\\', ';', '/', ':', '*' }; public string InputForLexer { get; private set; } diff --git a/QueryProcessing/TaskExtension.cs b/QueryProcessing/Utilities/TaskExtension.cs similarity index 100% rename from QueryProcessing/TaskExtension.cs rename to QueryProcessing/Utilities/TaskExtension.cs diff --git a/QueryProcessing/async.cs b/QueryProcessing/async.cs deleted file mode 100644 index cae4960..0000000 --- a/QueryProcessing/async.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace QueryProcessing -{ - public class async - { - } -} \ No newline at end of file diff --git a/bgdb.sln b/bgdb.sln index a91ccf1..c775e65 100644 --- a/bgdb.sln +++ b/bgdb.sln @@ -39,6 +39,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LockManagerTests", "tests\L EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Instrumentation", "Instrumentation\Instrumentation.csproj", "{E53631B2-B716-4418-8196-506C6A162846}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageProcessing", "ImageProcessing\ImageProcessing.csproj", "{D888FA29-F32D-4BC6-BCF1-5F5775B02A08}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageProcessingTests", "tests\ImageProcessingTests\ImageProcessingTests.csproj", "{C0D3709F-7490-47ED-96C6-E6FD6786E6ED}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -117,6 +121,14 @@ Global {E53631B2-B716-4418-8196-506C6A162846}.Debug|Any CPU.Build.0 = Debug|Any CPU {E53631B2-B716-4418-8196-506C6A162846}.Release|Any CPU.ActiveCfg = Release|Any CPU {E53631B2-B716-4418-8196-506C6A162846}.Release|Any CPU.Build.0 = Release|Any CPU + {D888FA29-F32D-4BC6-BCF1-5F5775B02A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D888FA29-F32D-4BC6-BCF1-5F5775B02A08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D888FA29-F32D-4BC6-BCF1-5F5775B02A08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D888FA29-F32D-4BC6-BCF1-5F5775B02A08}.Release|Any CPU.Build.0 = Release|Any CPU + {C0D3709F-7490-47ED-96C6-E6FD6786E6ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C0D3709F-7490-47ED-96C6-E6FD6786E6ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C0D3709F-7490-47ED-96C6-E6FD6786E6ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C0D3709F-7490-47ED-96C6-E6FD6786E6ED}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tests/E2EQueryExecutionTests/E2EQueryExecutionTests.csproj b/tests/E2EQueryExecutionTests/E2EQueryExecutionTests.csproj index a36c6ec..4b3a578 100644 --- a/tests/E2EQueryExecutionTests/E2EQueryExecutionTests.csproj +++ b/tests/E2EQueryExecutionTests/E2EQueryExecutionTests.csproj @@ -23,6 +23,7 @@ + @@ -30,4 +31,14 @@ + + + Always + + + + + Always + + diff --git a/tests/E2EQueryExecutionTests/FileSystemProviderTests.cs b/tests/E2EQueryExecutionTests/FileSystemProviderTests.cs new file mode 100644 index 0000000..78ad055 --- /dev/null +++ b/tests/E2EQueryExecutionTests/FileSystemProviderTests.cs @@ -0,0 +1,106 @@ +using NUnit.Framework; +using PageManager; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace E2EQueryExecutionTests +{ + public class FileSystemProviderTests : BaseTestSetup + { + [SetUp] + public new async Task Setup() + { + await base.Setup(); + } + + [Test] + public async Task FetchFileSystemTest() + { + await using ITransaction tran = this.logManager.CreateTransaction(pageManager, "GET_ROWS"); + const string query = "SELECT * FROM FILESYSTEM('./assets')"; + RowHolder[] result = await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); + await tran.Commit(); + + var expectedResults = new [] + { + "file.mkv", + "file1.txt", + "file2.txt", + }; + + Assert.AreEqual(3, result.Length); + + foreach (RowHolder rh in result) + { + string fullPath = new string(rh.GetStringField(0)); + string fileName = new string(rh.GetStringField(1)); + string extension = new string(rh.GetStringField(2)); + int length = rh.GetField(3); + + Assert.IsTrue(expectedResults.Contains(fileName)); + System.IO.FileInfo fi = new System.IO.FileInfo(fullPath); + Assert.IsTrue(fullPath.Contains(fileName)); + Assert.AreEqual(fi.Name, fileName); + Assert.AreEqual(fi.Extension, extension); + Assert.AreEqual(fi.Length, length); + } + } + + [Test] + public async Task FetchFileSystemWithFilter() + { + await using ITransaction tran = this.logManager.CreateTransaction(pageManager, "GET_ROWS"); + const string query = "SELECT * FROM FILESYSTEM('./assets') WHERE Extension = '.txt'"; + RowHolder[] result = await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); + await tran.Commit(); + + var expectedResults = new[] { "file2.txt", "file1.txt" }; + + Assert.AreEqual(2, result.Length); + + foreach (RowHolder rh in result) + { + string fullPath = new string(rh.GetStringField(0)); + string fileName = new string(rh.GetStringField(1)); + string extension = new string(rh.GetStringField(2)); + int length = rh.GetField(3); + + Assert.IsTrue(expectedResults.Contains(fileName)); + System.IO.FileInfo fi = new System.IO.FileInfo(fullPath); + Assert.IsTrue(fullPath.Contains(fileName)); + Assert.AreEqual(fi.Name, fileName); + Assert.AreEqual(fi.Extension, extension); + Assert.AreEqual(fi.Length, length); + } + } + + [Test] + public async Task GroupBySizeByExtension() + { + await using ITransaction tran = this.logManager.CreateTransaction(pageManager, "GET_ROWS"); + const string query = "SELECT Extension, SUM(FileSize) FROM FILESYSTEM('./assets') GROUP BY Extension"; + RowHolder[] result = await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); + await tran.Commit(); + + var expectedResults = new Dictionary + { + { ".txt", 26 }, + { ".mkv", 12 }, + }; + + Assert.AreEqual(2, result.Length); + + foreach (RowHolder rh in result) + { + string extension = new string(rh.GetStringField(0)); + + Assert.IsTrue(expectedResults.ContainsKey(extension)); + + // TODO: File size may differ on linux and windows. + // so sipping this check for now. + // Assert.AreEqual(expectedResults[extension], lengthSum); + } + } + } +} diff --git a/tests/E2EQueryExecutionTests/ImageClassificationTests.cs b/tests/E2EQueryExecutionTests/ImageClassificationTests.cs new file mode 100644 index 0000000..1510ce8 --- /dev/null +++ b/tests/E2EQueryExecutionTests/ImageClassificationTests.cs @@ -0,0 +1,44 @@ +using ImageProcessing; +using NUnit.Framework; +using PageManager; +using QueryProcessing; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace E2EQueryExecutionTests +{ + public class ImageClassificationTests : BaseTestSetup + { + [SetUp] + public new async Task Setup() + { + await base.Setup(); + IFunctionMappingHandler mappingHandler = new ImageObjectClassificationFuncMappingHandler(); + FuncCallMapper.RegisterFunc("CLASSIFY_IMAGE", mappingHandler); + } + + [Test] + public async Task FetchFileSystemTest() + { + await using ITransaction tran = this.logManager.CreateTransaction(pageManager, "GET_ROWS"); + const string query = "SELECT CLASSIFY_IMAGE(FilePath), FilePath, FileName FROM FILESYSTEM('./assets/pics') WHERE EXTENSION = '.jpg' OR EXTENSION = '.jfif'"; + RowHolder[] result = await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); + await tran.Commit(); + + var expectedResults = new Dictionary + { + { "basketball.jpg", "basketball" }, + { "hippo.jfif", "hippopotamus" }, + }; + + foreach (RowHolder rh in result) + { + string classificationResult = new string(rh.GetStringField(0)); + string fileName = new string(rh.GetStringField(2)); + + Assert.AreEqual(expectedResults[fileName], classificationResult); + } + } + } +} diff --git a/tests/E2EQueryExecutionTests/assets/file.mkv b/tests/E2EQueryExecutionTests/assets/file.mkv new file mode 100644 index 0000000..efc9487 --- /dev/null +++ b/tests/E2EQueryExecutionTests/assets/file.mkv @@ -0,0 +1 @@ +some video diff --git a/tests/E2EQueryExecutionTests/assets/file1.txt b/tests/E2EQueryExecutionTests/assets/file1.txt new file mode 100644 index 0000000..6e099dc --- /dev/null +++ b/tests/E2EQueryExecutionTests/assets/file1.txt @@ -0,0 +1 @@ +some_content diff --git a/tests/E2EQueryExecutionTests/assets/file2.txt b/tests/E2EQueryExecutionTests/assets/file2.txt new file mode 100644 index 0000000..de8ed3a --- /dev/null +++ b/tests/E2EQueryExecutionTests/assets/file2.txt @@ -0,0 +1 @@ +more stuff diff --git a/tests/E2EQueryExecutionTests/assets/pics/basketball.jpg b/tests/E2EQueryExecutionTests/assets/pics/basketball.jpg new file mode 100644 index 0000000..78116ad Binary files /dev/null and b/tests/E2EQueryExecutionTests/assets/pics/basketball.jpg differ diff --git a/tests/E2EQueryExecutionTests/assets/pics/hippo.jfif b/tests/E2EQueryExecutionTests/assets/pics/hippo.jfif new file mode 100644 index 0000000..77fd45a Binary files /dev/null and b/tests/E2EQueryExecutionTests/assets/pics/hippo.jfif differ diff --git a/tests/ImageProcessingTests/.gitignore b/tests/ImageProcessingTests/.gitignore new file mode 100644 index 0000000..4ded7c4 --- /dev/null +++ b/tests/ImageProcessingTests/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/obj/ diff --git a/tests/ImageProcessingTests/ImageProcessingTests.csproj b/tests/ImageProcessingTests/ImageProcessingTests.csproj new file mode 100644 index 0000000..828e673 --- /dev/null +++ b/tests/ImageProcessingTests/ImageProcessingTests.csproj @@ -0,0 +1,26 @@ + + + + netcoreapp3.1 + + false + + + + + + + + + + + + + + + + + Always + + + diff --git a/tests/ImageProcessingTests/LabelExtractionTests.cs b/tests/ImageProcessingTests/LabelExtractionTests.cs new file mode 100644 index 0000000..9b2794f --- /dev/null +++ b/tests/ImageProcessingTests/LabelExtractionTests.cs @@ -0,0 +1,48 @@ +using ImageProcessing; +using System.IO; +using System.Collections.Generic; +using NUnit.Framework; + +namespace ImageProcessingTests +{ + public class LabelExtractionTests + { + private static string GetImageInputPath() + { + FileInfo dataRoot = new FileInfo(typeof(LabelExtractionTests).Assembly.Location); + string assemblyFolderPath = dataRoot.Directory.FullName; + return Path.Combine(assemblyFolderPath, "assets", "images"); + } + + [Test] + public void ExtractLabelSingle() + { + var imagesFolder = GetImageInputPath(); + var inceptionPb = "tensorflow_inception_graph.pb"; + var labelsTxt = "imagenet_comp_graph_label_strings.txt"; + + // TODO: These are results of imagenet model. + // Hardcoding results. + // With support for different models this will need to be more generic. + Dictionary mappings = new Dictionary() + { + { "broccoli.jpg", "broccoli" }, + { "canoe3.jpg", "canoe" }, + { "coffeepot2.jpg", "coffeepot" }, + { "nba.jfif", "basketball" }, + { "office.jpg", "desktop computer" }, + { "yoda.jfif", "trench coat" } + }; + + TFModelImageLabelScorer scorer = new TFModelImageLabelScorer(inceptionPb, labelsTxt); + foreach (var file in Directory.GetFiles(imagesFolder)) + { + ImageLabelPredictionProbability score = scorer.ScoreSingle(file); + + string fileName = Path.GetFileName(score.ImagePath); + string correctLabel = mappings[fileName]; + Assert.AreEqual(correctLabel, score.PredictedLabels[0]); + } + } + } +} diff --git a/tests/ImageProcessingTests/assets/images/broccoli.jpg b/tests/ImageProcessingTests/assets/images/broccoli.jpg new file mode 100644 index 0000000..da52922 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/broccoli.jpg differ diff --git a/tests/ImageProcessingTests/assets/images/canoe3.jpg b/tests/ImageProcessingTests/assets/images/canoe3.jpg new file mode 100644 index 0000000..ba693b9 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/canoe3.jpg differ diff --git a/tests/ImageProcessingTests/assets/images/coffeepot2.jpg b/tests/ImageProcessingTests/assets/images/coffeepot2.jpg new file mode 100644 index 0000000..032e339 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/coffeepot2.jpg differ diff --git a/tests/ImageProcessingTests/assets/images/nba.jfif b/tests/ImageProcessingTests/assets/images/nba.jfif new file mode 100644 index 0000000..ac75604 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/nba.jfif differ diff --git a/tests/ImageProcessingTests/assets/images/office.jpg b/tests/ImageProcessingTests/assets/images/office.jpg new file mode 100644 index 0000000..9f3a572 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/office.jpg differ diff --git a/tests/ImageProcessingTests/assets/images/yoda.jfif b/tests/ImageProcessingTests/assets/images/yoda.jfif new file mode 100644 index 0000000..bdd41d9 Binary files /dev/null and b/tests/ImageProcessingTests/assets/images/yoda.jfif differ diff --git a/tests/ParserLexerTests/ParserTests.cs b/tests/ParserLexerTests/ParserTests.cs index 4ba08e8..c12a3b8 100644 --- a/tests/ParserLexerTests/ParserTests.cs +++ b/tests/ParserLexerTests/ParserTests.cs @@ -339,6 +339,17 @@ public void SubqueryTest() Assert.AreEqual("T", ((Sql.sqlStatementOrId.FromTable)selectStatement.From).Item); } + [Test] + public void SelectFromFileSystemTest() + { + string query = @"SELECT * FROM FILESYSTEM('some_path')"; + var selectStatement = GetSelectStatement(query); + Assert.IsTrue(selectStatement.From.IsFileSystemProvider); + var fileSystemProvider = ((Sql.sqlStatementOrId.FileSystemProvider)selectStatement.From); + Assert.IsTrue(fileSystemProvider.Item.IsString); + Assert.AreEqual(((Sql.value.String)fileSystemProvider.Item).Item, "some_path"); + } + #region Helper private Sql.sqlStatement GetSelectStatement(string query) {