Exemplo n.º 1
0
        public override ExprNode Validate(ExprValidationContext validationContext)
        {
            if (ChildNodes.Count < 2)
            {
                throw new ExprValidationException("Concat node must have at least 2 parameters");
            }

            ExprEvaluator[] evaluators = ExprNodeUtility.GetEvaluators(this.ChildNodes);

            for (var i = 0; i < evaluators.Length; i++)
            {
                var childType     = evaluators[i].ReturnType;
                var childTypeName = childType == null ? "null" : Name.Clean(childType);
                if (childType != typeof(String))
                {
                    throw new ExprValidationException(string.Format("Implicit conversion from datatype '{0}' to string is not allowed", childTypeName));
                }
            }

            ConfigurationEngineDefaults.ThreadingProfile threadingProfile = validationContext.EngineImportService.ThreadingProfile;
            if (threadingProfile == ConfigurationEngineDefaults.ThreadingProfile.LARGE)
            {
                _evaluator = new ExprConcatNodeEvalWNew(this, evaluators);
            }
            else
            {
                _evaluator = new ExprConcatNodeEvalThreadLocal(this, evaluators, validationContext.ThreadLocalManager);
            }

            return(null);
        }
Exemplo n.º 2
0
        private void runAssertionThreading(ConfigurationEngineDefaults.ThreadingProfile threadingProfile)
        {
            _concatNode = new ExprConcatNode();
            var textA = "This is the first text";
            var textB = "Second text";
            var textC = "Third text, some more";

            foreach (var text in new[] { textA, textB, textC })
            {
                _concatNode.AddChildNode(new ExprConstantNodeImpl(text));
            }
            _concatNode.Validate(ExprValidationContextFactory.MakeEmpty(threadingProfile));

            var numThreads = 4;
            var numLoop    = 10000;

            var threads = new List <SupportConcatThread>(numThreads);

            for (var i = 0; i < numThreads; i++)
            {
                var thread = new SupportConcatThread(_concatNode, numLoop, textA + textB + textC);
                threads.Add(thread);
                thread.Start();
            }

            foreach (var thread in threads)
            {
                thread.Join();
                Assert.IsFalse(thread.IsFail);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="allowExtendedAggregationFunc">true to allow non-SQL standard builtin agg functions.</param>
 /// <param name="isUdfCache">if set to <c>true</c> [is udf cache].</param>
 /// <param name="isDuckType">if set to <c>true</c> [is duck type].</param>
 /// <param name="sortUsingCollator">if set to <c>true</c> [sort using collator].</param>
 /// <param name="optionalDefaultMathContext">The optional default math context.</param>
 /// <param name="timeZone"></param>
 /// <param name="threadingProfile"></param>
 /// <param name="aggregationFactoryFactory"></param>
 public EngineImportServiceImpl(
     bool allowExtendedAggregationFunc,
     bool isUdfCache,
     bool isDuckType,
     bool sortUsingCollator,
     MathContext optionalDefaultMathContext,
     TimeZoneInfo timeZone,
     ConfigurationEngineDefaults.ThreadingProfile threadingProfile,
     AggregationFactoryFactory aggregationFactoryFactory)
 {
     _imports                      = new List <AutoImportDesc>();
     _annotationImports            = new List <AutoImportDesc>();
     _aggregationFunctions         = new Dictionary <String, ConfigurationPlugInAggregationFunction>();
     _aggregationAccess            = new List <Pair <ISet <String>, ConfigurationPlugInAggregationMultiFunction> >();
     _singleRowFunctions           = new Dictionary <String, EngineImportSingleRowDesc>();
     _methodInvocationRef          = new Dictionary <String, ConfigurationMethodRef>();
     _allowExtendedAggregationFunc = allowExtendedAggregationFunc;
     IsUdfCache                    = isUdfCache;
     IsDuckType                    = isDuckType;
     _sortUsingCollator            = sortUsingCollator;
     _optionalDefaultMathContext   = optionalDefaultMathContext;
     _timeZone                     = timeZone;
     _threadingProfile             = threadingProfile;
     _aggregationFactoryFactory    = aggregationFactoryFactory;
 }
 public static ExprValidationContext MakeEmpty(ConfigurationEngineDefaults.ThreadingProfile threadingProfile)
 {
     return(new ExprValidationContext(
                null,
                new MethodResolutionServiceImpl(new EngineImportServiceImpl(false, false, false, false, null, TimeZoneInfo.Local, threadingProfile), null),
                null, null, null, null, new SupportExprEvaluatorContext(null), null, null, null, null, null, null,
                false, false, false, false, null, false));
 }
 public static ExprValidationContext MakeEmpty(ConfigurationEngineDefaults.ThreadingProfile threadingProfile)
 {
     return(new ExprValidationContext(
                null,
                new EngineImportServiceImpl(false, false, false, false, null, TimeZoneInfo.Local, threadingProfile, AggregationFactoryFactoryDefault.INSTANCE),
                null, null, null, null, null, new SupportExprEvaluatorContext(null), null, null, 1, null, null, null,
                false, false, false, false, null, false));
 }
Exemplo n.º 6
0
 public static ExprValidationContext MakeEmpty(
     IContainer container,
     ConfigurationEngineDefaults.ThreadingProfile threadingProfile)
 {
     return new ExprValidationContext(
         container,
         null,
         new EngineImportServiceImpl(
             false, false, false, false, null,
             TimeZoneInfo.Local,
             TimeAbacusMilliseconds.INSTANCE,
             threadingProfile, null,
             AggregationFactoryFactoryDefault.INSTANCE,
             false, "default", null,
             container.Resolve<ClassLoaderProvider>()),
         null, null, null, null, null,
         new SupportExprEvaluatorContext(container, null), null, null, 1, null, null, null,
         false, false, false, false, null, false);
 }
Exemplo n.º 7
0
 public EngineImportServiceImpl(
     bool allowExtendedAggregationFunc,
     bool isUdfCache,
     bool isDuckType,
     bool sortUsingCollator,
     MathContext optionalDefaultMathContext,
     TimeZoneInfo timeZone,
     TimeAbacus timeAbacus,
     ConfigurationEngineDefaults.ThreadingProfile threadingProfile,
     IDictionary<string, object> transientConfiguration,
     AggregationFactoryFactory aggregationFactoryFactory,
     bool isCodegenEventPropertyGetters,
     string engineURI,
     ICodegenContext context,
     ClassLoaderProvider classLoaderProvider)
 {
     _imports = new List<AutoImportDesc>();
     _annotationImports = new List<AutoImportDesc>(2);
     _aggregationFunctions = new Dictionary<string, ConfigurationPlugInAggregationFunction>();
     _aggregationAccess = new List<Pair<ISet<string>, ConfigurationPlugInAggregationMultiFunction>>();
     _singleRowFunctions = new Dictionary<string, EngineImportSingleRowDesc>();
     _methodInvocationRef = new Dictionary<string, ConfigurationMethodRef>();
     _allowExtendedAggregationFunc = allowExtendedAggregationFunc;
     IsUdfCache = isUdfCache;
     IsDuckType = isDuckType;
     IsSortUsingCollator = sortUsingCollator;
     DefaultMathContext = optionalDefaultMathContext;
     TimeZone = timeZone;
     TimeAbacus = timeAbacus;
     ThreadingProfile = threadingProfile;
     _transientConfiguration = transientConfiguration;
     AggregationFactoryFactory = aggregationFactoryFactory;
     _advancedIndexProviders = new LinkedHashMap<string, AdvancedIndexFactoryProvider>();
     _advancedIndexProviders.Put("pointregionquadtree", new AdvancedIndexFactoryProviderPointRegionQuadTree());
     _advancedIndexProviders.Put("mxcifquadtree", new AdvancedIndexFactoryProviderMXCIFQuadTree());
     IsCodegenEventPropertyGetters = isCodegenEventPropertyGetters;
     _engineURI = engineURI;
     _context = context;
     _classLoaderProvider = classLoaderProvider;
 }