public IWriter <T> GetWriter <T>(DataSetInfo dataSetInfo) { var testWriter = new TestWriter <T>(dataSetInfo); Writers.Add(dataSetInfo, testWriter); return(testWriter); }
/// <summary> /// /// </summary> /// <param name="ds"></param> /// <returns></returns> public int CreateDataTable(DataSetInfo ds) { int rows = 0; List <string> lsFields = GetColumnListByDataSetInfo(ds); StringBuilder strCreate = new StringBuilder(); strCreate.Append("CREATE TABLE "); strCreate.Append(ds.TableName); strCreate.Append(" ([id] [int] IDENTITY(1,1) PRIMARY KEY, [spatial] [geometry] NULL,"); foreach (string field in lsFields) { strCreate.Append(field); strCreate.Append(" varchar(1000),"); } strCreate.Remove(strCreate.Length - 1, 1); strCreate.Append(")"); try { rows = SqlDbHelper.ExecuteSql(strCreate.ToString(), null); } catch (Exception ex) { HandleException(ex); } return(rows); }
// GET: Filter public ActionResult Index() { FilterView clsFiltVw = null; DataSetInfo clsDSInf = null; TPFilter clsFilt = null; List <SelectListItem> selDays; SelectedIDsAndItems vmSelDays = null; APIHelper apiHlp; SavedDataHelper sdHlp; string strErr = ""; try { clsFiltVw = new FilterView(); selDays = new List <SelectListItem>(); vmSelDays = new SelectedIDsAndItems(); apiHlp = new APIHelper(); sdHlp = new SavedDataHelper(); if (apiHlp.GetDataSet(User.Identity.Name, 440, ref clsDSInf, ref strErr)) { if (clsDSInf.DayName != null && clsDSInf.DayNameAbbrev != null) { for (int i = 0; i < 7; i++) { selDays.Add(new SelectListItem { Text = clsDSInf.DayName[i], Value = clsDSInf.DayName[i] }); } } if (sdHlp.LoadItem(User.Identity.Name, null, null, "TPFilter", ref clsFilt, ref strErr)) { clsFiltVw.Filter = clsFilt; } else { clsFilt = new TPFilter(clsDSInf.DayNameAbbrev); } vmSelDays.Items = selDays; vmSelDays.SelectedItemIds = clsFilt.DaysOfWk; clsFiltVw.DaysOfWeek = vmSelDays; clsFiltVw.Filter = clsFilt; } else { ModelState.AddModelError("", "Could not retrieve days of the week"); } vmSelDays.Items = selDays; clsFiltVw.DaysOfWeek = vmSelDays; } catch (Exception exc) { ModelState.AddModelError("", "Unexpected error:" + exc.Message); } return(View(clsFiltVw)); }
/// <summary> /// get data list by dataset id and boundary info /// </summary> /// <param name="id"></param> /// <param name="boundary"></param> /// <returns></returns> public List <DataInfo> GetDataListByDataSetId(int id, string boundary, int level = -1) { List <DataInfo> lsData = new List <DataInfo>(); DataSetManager dsMgr = null; DataSetInfo ds = null; // get datasetinfo by dataset id try { dsMgr = new DataSetManager(); ds = dsMgr.GetDataSetById(id); } catch (Exception ex) { HandleException(ex); } // if datasetinfo is null, return empty data list if (ds == null) { return(lsData); } // if datasetinfo is not null, get data list return(this.GetDataListByDataSetInfo(ds, boundary, level)); }
public HyperWriter(DataSetInfo dataSetInfo, Endpoint server, string hyperOutputDir, string tableName, ILogger logger) : base(dataSetInfo, logger, nameof(HyperWriter <T>)) { _updateAction = UpdateAction(); _dbPath = Path.Combine(Path.GetFullPath(hyperOutputDir), $"{tableName}.hyper"); // Create our DB file if it doesn't already exist if (!File.Exists(_dbPath)) { using (var createDbConnection = new Connection(server)) { createDbConnection.Catalog.CreateDatabaseIfNotExists(_dbPath); } } // Create our table if it doesn't already exist var connection = HyperConnectionManager.Instance.GetConnection(server, _dbPath); connection.Catalog.CreateTableIfNotExists(new TableDefinition(tableName, GetColumnDefs())); if (!connection.Catalog.HasTable(tableName)) { var columnDefs = GetColumnDefs(); var tableDef = new TableDefinition(tableName, columnDefs); connection.Catalog.CreateTable(tableDef); } _inserter = new Inserter(connection, tableName); Logger.LogDebug("{writerType} created for database {databasePath} and table {tableName}", nameof(HyperWriter <T>), _dbPath, tableName); }
private void RenderResult(IScriptEditor editor, TabControl tabControl, ScriptExecutionResult execResult) { if (execResult == null || execResult.DataSets == null || execResult.DataSets.Count == 0) { return; } foreach (DataSet dataSet in execResult.DataSets) { if (dataSet == null || dataSet.Tables.Count == 0) { continue; } DataSetInfo dsInfo = editor.GetDataSetInfo(dataSet); string tabCaption = String.Format("{0} result(s) [{1}]", dataSet.Tables.Count, dsInfo.ServerDbInfo); TabPage tp = new TabPage(tabCaption); tp.ToolTipText = tabCaption; tabControl.TabPages.Add(tp); VirtualDBQueryResultViewer viewer = new VirtualDBQueryResultViewer(); viewer.Parent = tp; viewer.Dock = DockStyle.Fill; viewer.ActiveGridChanged += new ActiveGridChangedDelegate(viewer_ActiveGridChanged); viewer.RenderDataSet(editor, dataSet); _disposeList.Add(viewer); } }
private void importDataFromFile() { StreamReader reader = new StreamReader(@"C:\inetpub\wwwroot\GeoCloud\crime_data_clusters.txt"); string line = null; string[] fields = null; reader.ReadLine(); string lat = null, lon = null; int cluster_id = 0; List <DataInfo> lsData = new List <DataInfo>(); while ((line = reader.ReadLine()) != null) { fields = line.Split(','); lat = fields[1]; lon = fields[2]; cluster_id = int.Parse(fields[0]); DataInfo dt = new DataInfo(); dt.NonSpatial["cluster_id"] = cluster_id; dt.Spatial = "POINT (" + lon + " " + lat + ")"; lsData.Add(dt); //Response.Write(line); } DataManager dtMgr = new DataManager(); DataSetInfo ds = (new DataSetManager()).GetDataSetById(3); dtMgr.InsertDataList(lsData, ds); }
public bool GetDataSet(string vstrUser, int vintDS, ref DataSetInfo rclsDSInf, ref string rstrErr) { return(GetEntity(ENDPOINT_VAXI_RF_DATASET, vstrUser, vintDS, ref rclsDSInf, ref rstrErr)); }
/// <summary> /// format select sql through dataset info and boundary info /// </summary> /// <param name="ds">dataset info</param> /// <param name="boundary">boundary string</param> /// <returns>select sql</returns> private string GetSelectStrByDataSetInfo(DataSetInfo ds, string boundary, int level = -1) { StringBuilder strSelect = new StringBuilder(); strSelect.Append("SELECT id,"); strSelect.Append(ds.GeoColName + ".STAsText() spatial,"); strSelect.Append(ds.NonSpatialCols); strSelect.Append(" FROM "); strSelect.Append(ds.TableName); // if boundary is not null, add where clause if (boundary != null) { strSelect.Append(" WHERE " + ds.GeoColName + ".STIntersects(geometry::STPolyFromText('POLYGON((" + boundary + "))', 4326)) = 1"); } if (ds.HasLevel && level != -1) { strSelect.Append(" AND [min_show_level] <= " + level.ToString()); } strSelect.Append(" ORDER BY [id]"); return(strSelect.ToString()); }
private DataSetPublishingResult GetCompiledDataSet(DataSetInfo dataSetInfo, ICatalogItemContext dataSetContext) { StoredDataSet storedDataSet = this.m_catalogTempDB.GetCompiledDataSet(dataSetInfo); if (storedDataSet != null && !storedDataSet.Definition.SequenceEqual(dataSetInfo.Definition)) { storedDataSet = null; } if (storedDataSet == null) { DataSetPublishingResult result = default(DataSetPublishingResult); try { using (ControlSnapshot createChunkFactory = new ControlSnapshot()) { ReportProcessing reportProcessing = this.CreateAndConfigureReportProcessing(); PublishingContext sharedDataSetPublishingContext = new PublishingContext(dataSetContext, dataSetInfo.Definition, createChunkFactory, AppDomain.CurrentDomain, true, this.GetDataSourceForSharedDataSetHandler, reportProcessing.Configuration); result = reportProcessing.CreateSharedDataSet(sharedDataSetPublishingContext); } } catch (Exception inner) { throw new DefinitionInvalidException(dataSetInfo.AbsolutePath, inner); } storedDataSet = new StoredDataSet(dataSetInfo.Definition, result); this.m_catalogTempDB.SetCompiledDataSet(dataSetInfo, storedDataSet); } return(storedDataSet.PublishingResult); }
/// <summary> /// get datasetinfo from data info and other info /// </summary> /// <param name="data">data info</param> /// <param name="creator">dataset creator name</param> /// <param name="name">dataset name</param> /// <param name="description">dataset description</param> /// <returns>dataset info</returns> public DataSetInfo GetDataSetInfoByData(DataInfo data, string creator, string name, string description) { DataSetInfo ds = new DataSetInfo(); ds.Name = name; ds.PubDate = DateTime.Now; ds.TableName = ds.Name + "_" + ds.PubDate.Ticks.ToString(); ds.GeoColName = "spatial"; ds.Creator = creator; ds.Desc = description; // get all the non-spatial fields of data StringBuilder strNonSpatial = new StringBuilder(); foreach (string field in data.NonSpatial.Keys) { strNonSpatial.Append(field); strNonSpatial.Append(','); } // remove the comma in the end strNonSpatial.Remove(strNonSpatial.Length - 1, 1); ds.NonSpatialCols = strNonSpatial.ToString(); return(ds); }
private void GetSharedDataSetChunkAndProcess(bool processAsIRowConsumer, DataSetInfo dataSetInfo, ParameterInfoCollection datasetParameterCollection) { Global.Tracer.Assert(m_odpContext.ExternalProcessingContext != null && m_odpContext.ExternalProcessingContext.DataSetExecute != null, "Missing handler for shared dataset reference execution"); string text = null; if (!m_odpContext.ProcessReportParameters) { text = Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.ChunkManager.GenerateDataChunkName(m_odpContext, m_dataSet.ID, m_odpContext.InSubreport); } IRowConsumer originalRequest = processAsIRowConsumer ? ((IRowConsumer)this) : null; bool originalRequestNeedsDataChunk = !processAsIRowConsumer || WritesDataChunk; m_odpContext.ExternalProcessingContext.DataSetExecute.Process(dataSetInfo, text, originalRequestNeedsDataChunk, originalRequest, datasetParameterCollection, m_odpContext.ExternalProcessingContext); if (processAsIRowConsumer) { if (!m_odpContext.ProcessReportParameters) { m_odpContext.OdpMetadata.AddDataChunk(text, m_dataSetInstance); } } else { m_dataReader = new ProcessingDataReader(m_dataSetInstance, m_dataSet, m_odpContext, overrideWithSharedDataSetChunkSettings: true); } }
public IWriter <T> GetWriter <T>(DataSetInfo dataSetInfo) { _logger.LogDebug("Creating writer for {dataSetInfo}", dataSetInfo); var path = Path.Combine(_outputDirectory, $"{dataSetInfo.Group}_{dataSetInfo.Name}.csv"); return(new CsvFileWriter <T>(dataSetInfo, path, _appending, _loggerFactory.CreateLogger <CsvFileWriter <T> >())); }
public void SetCompiledDataSet(DataSetInfo dataSetInfo, StoredDataSet storedDataSet) { if (storedDataSet == null) { throw new ArgumentNullException("storedDataSet"); } this.m_compiledDataSets[dataSetInfo.AbsolutePath] = storedDataSet; }
public void VerifyEqualityOperator() { var info1 = new DataSetInfo("group", "name"); var info2 = new DataSetInfo("group", "name"); var areEqual = info1 == info2; areEqual.Should().Be(true); }
public StoredDataSet GetCompiledDataSet(DataSetInfo dataSetInfo) { if (dataSetInfo == null) { throw new ArgumentNullException("dataSetInfo"); } m_compiledDataSets.TryGetValue(dataSetInfo.AbsolutePath, out StoredDataSet value); return value; }
public IWriter <T> GetWriter <T>(DataSetInfo dataSetInfo) { _logger.LogDebug("Creating writer for {outputInfo}", dataSetInfo); var sqlWriter = new SqlWriter <T>(_repository, dataSetInfo, _loggerFactory.CreateLogger <SqlWriter <T> >()); sqlWriter.InitializeTable(_runSummaryIdColumnName, _runSummaryId, _config.PostgresSkipDatabaseVerificationAndInitialization).Wait(); return(sqlWriter); }
public CsvFileWriter(DataSetInfo dataSetInfo, string filename, bool appending, ILogger logger) : base(dataSetInfo, logger, nameof(CsvFileWriter <T>)) { _filename = filename; _textWriter = new StreamWriter(filename, appending); _csvWriter = new CsvWriter(_textWriter, new CsvConfiguration(CultureInfo.InvariantCulture)); Logger.LogDebug("{writerType} created for {outputFileName}", nameof(CsvFileWriter <T>), filename); }
public void GenerateTypeProjection <T>(DataSetInfo outputInfo) { var type = typeof(T); if (!_typeProjections.ContainsKey(type)) { _typeProjections[type] = new NpgsqlTypeProjection <T>(outputInfo); } }
public void VerifyEqualityMethod() { var info1 = new DataSetInfo("group", "name"); var info2 = new DataSetInfo("group", "name"); var areEqual = info1.Equals(info2); areEqual.Should().Be(true); }
protected bool ProcessSharedDataSetReference() { DataSetInfo dataSetInfo = null; if (m_odpContext.SharedDataSetReferences != null) { if (Guid.Empty != m_dataSet.DataSetCore.CatalogID) { dataSetInfo = m_odpContext.SharedDataSetReferences.GetByID(m_dataSet.DataSetCore.CatalogID); } if (dataSetInfo == null) { dataSetInfo = m_odpContext.SharedDataSetReferences.GetByName(m_dataSet.DataSetCore.Name, m_odpContext.ReportContext); } } if (dataSetInfo == null) { throw new ReportProcessingException(ErrorCode.rsInvalidSharedDataSetReference, m_dataSet.Name.MarkAsPrivate(), m_dataSet.SharedDataSetQuery.SharedDataSetReference); } List <Microsoft.ReportingServices.ReportIntermediateFormat.ParameterValue> parameters = m_dataSet.SharedDataSetQuery.Parameters; SharedDataSetParameterNameMapper.MakeUnique(parameters); ParameterInfoCollection parameterInfoCollection = new ParameterInfoCollection(); object[] array = new object[parameters?.Count ?? 0]; for (int i = 0; i < array.Length; i++) { array[i] = parameters[i].EvaluateQueryParameterValue(m_odpContext, m_dataSet.ExprHost); if (m_dataSet.IsReferenceToSharedDataSet) { ParameterInfo parameterInfo = new ParameterInfo(parameters[i]); parameterInfo.Name = parameters[i].UniqueName; parameterInfo.SetValuesFromQueryParameter(array[i]); parameterInfo.DataType = DataType.Object; parameterInfoCollection.Add(parameterInfo); } } m_odpContext.CheckAndThrowIfAborted(); m_executionMetrics.StartTotalTimer(); try { GetSharedDataSetChunkAndProcess(processAsIRowConsumer: true, dataSetInfo, parameterInfoCollection); } finally { m_executionMetrics.RecordTotalTimerMeasurement(); } if (!m_odpContext.IsSharedDataSetExecutionOnly && m_dataSetInstance != null) { m_dataSetInstance.SaveCollationSettings(m_dataSet); UpdateReportOMDataSet(); } return(false); }
/// <summary> /// get column list of the data table by dataset info /// </summary> /// <param name="ds">dataset info</param> /// <returns>column list</returns> private List <string> GetColumnListByDataSetInfo(DataSetInfo ds) { List <string> cols = new List <string>(); //cols.Add(ds.GeoColName); foreach (string col in ds.NonSpatialCols.Split(',')) { cols.Add(col); } return(cols); }
public StoredDataSet GetCompiledDataSet(DataSetInfo dataSetInfo) { if (dataSetInfo == null) { throw new ArgumentNullException("dataSetInfo"); } StoredDataSet result = default(StoredDataSet); this.m_compiledDataSets.TryGetValue(dataSetInfo.AbsolutePath, out result); return(result); }
public void VerifyHashSetFunctionality() { var info1 = new DataSetInfo("group", "name"); var info2 = new DataSetInfo("group", "name"); var set = new HashSet <DataSetInfo> { info1 }; var secondElementAdded = set.Add(info2); secondElementAdded.Should().Be(false); }
private void Btn_datasetInfo_Click(object sender, RoutedEventArgs e) { if (this.m_mathSet != null) { DataSetInfo info = this.m_mathSet.SetInformation; this.m_workInfo.AddInfornation(info.ToString()); } else { this.m_workInfo.AddWarning("набор данных не загружен"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int orginalDataSetId = -1; string processMethodName = ""; DataSetInfo dsInfo = new DataSetInfo(); Hashtable htParas = new Hashtable(); // get all parameters foreach (string paraName in Request.QueryString.Keys) { // if value of the parameter is not null or "" if (Request.QueryString[paraName] != null && Request.QueryString[paraName].Trim() != "") { if (paraName.ToLower() == "id") // get original dataset id { orginalDataSetId = int.Parse(Request.QueryString[paraName].Trim()); } else if (paraName.ToLower() == "methodname") // get dataset processing method name { processMethodName = Request.QueryString[paraName].Trim(); } else if (paraName.ToLower() == "targetname") { dsInfo.Name = Request.QueryString[paraName].Trim(); } else // get other parameters { htParas[paraName] = Request.QueryString[paraName].Trim(); } } } List <DataInfo> lsData = this.GetDataListByDataSetInfo(orginalDataSetId, null); if (lsData.Count < 1) { Response.Write("no data!"); return; } List <DataInfo> lsDstData = null; ProcessingFactory.GetProcessingMethod(ProcessingMethod.CLUSTERING).Process(lsData, htParas, out lsDstData); DataSetManager dsMgr = new DataSetManager(); DataSetInfo ds = dsMgr.GetDataSetInfoByData(lsDstData[0], "Jin Lu", dsInfo.Name, "test clustering"); dsMgr.InsertDataSet(ds); DataManager dtMgr = new DataManager(); dtMgr.CreateDataTable(ds); dtMgr.InsertDataList(lsDstData, ds); } }
/// <summary> /// insert data list into database /// </summary> /// <param name="lsData">the data list to insert</param> /// <param name="ds">the dataset info of the data list</param> /// <returns></returns> public int InsertDataList(List <DataInfo> lsData, DataSetInfo ds) { int rows = 0; List <string> lsStrSql = new List <string>(); List <SqlParameter[]> lsParas = new List <SqlParameter[]>(); // format insert sql string string strInsert = FormatInsertSqlByDataSetInfo(ds); List <SqlParameter> lsPara = new List <SqlParameter>(); // create sql parameters list foreach (DataInfo dt in lsData) { lsPara.Clear(); lsPara.Add(new SqlParameter("@spatial", dt.Spatial)); foreach (string key in dt.NonSpatial.Keys) { lsPara.Add(new SqlParameter("@" + key, dt.NonSpatial[key])); } SqlParameter[] paras = lsPara.ToArray(); // add sql and sql parameters to list lsStrSql.Add(strInsert); lsParas.Add(paras); } // make the spatial column valid after insert string sqlMakeValid = "UPDATE " + ds.TableName + " SET [spatial] = [spatial].MakeValid()"; lsStrSql.Add(sqlMakeValid); lsParas.Add(null); // create spatial index on spatial column string sqlCreateIndex = "CREATE SPATIAL INDEX idx_" + ds.TableName + "_spatial ON " + ds.TableName + "(spatial) with (BOUNDING_BOX = (-180, -180, 180, 180));"; lsStrSql.Add(sqlCreateIndex); lsParas.Add(null); try { rows = SqlDbHelper.ExecuteSqlList(lsStrSql, lsParas); } catch (Exception ex) { HandleException(ex); } return(rows); }
private void readAscFile() { string dataDir = "upload"; string fileName = Server.MapPath(dataDir) + "\\crime_mb.asc"; List <DataInfo> lsData = FileHandlerFactory.getFileHandler(FileType.FILETYPE_ASC).ReadFromFile(fileName, 0, 10000); if (lsData.Count > 0) { DataSetManager dsMgr = new DataSetManager(); DataSetInfo ds = dsMgr.GetDataSetInfoByData(lsData[0], "Jin", "crime_mb_test", "test"); dsMgr.InsertDataSet(ds); DataManager dataMgr = new DataManager(); dataMgr.CreateDataTable(ds); dataMgr.InsertDataList(lsData, ds); } }
public NpgsqlTypeProjection(DataSetInfo dataSetInfo) { var typeAttributes = typeof(T).GetCustomAttributes(true).Select(a => a as Attribute); var tableAttribute = typeAttributes.OfType <TableAttribute>().FirstOrDefault(); _tableNameIsSetFromAttribute = tableAttribute?.Name != null; TableName = (tableAttribute?.Name ?? (dataSetInfo != null ? $"{dataSetInfo.Name}" : null) ?? typeof(T).Name); Schema = tableAttribute?.Schema ?? DefaultSchema; TypePropertyProjections = typeof(T) .GetProperties() .Where(p => p.CanRead) .Select(property => new NpgsqlTypePropertyProjection <T>(property)) .OrderBy(tpp => tpp.Order) .ThenBy(tpp => tpp.ColumnName) .ToList(); }
/// <summary> /// get data set by id /// </summary> /// <param name="id">data set id</param> /// <returns>the data set with specified id</returns> public DataSetInfo GetDataSetById(int id) { DataSetInfo ds = null; string strSelect = "SELECT [id],[name],[creator],[desc],[pubdate],[table_name],[geo_col_name],[non_spatial_cols] FROM [geo_cloud].[dbo].[dataset_info] WHERE [id]=@id"; SqlParameter[] paras = { new SqlParameter("@id", System.Data.SqlDbType.Int) }; int index = 0; paras[index++].Value = id; SqlDataReader reader = null; SqlConnection conn = null; try { reader = SqlDbHelper.ExecuteSqlGetReader(strSelect, paras, out conn); if (reader != null) { if (reader.Read()) { ds = this.GetDataSetInfoFromReader(reader); } } } catch (Exception ex) { this.HandleException(ex); } finally { if (!reader.IsClosed) { reader.Close(); } if (conn != null && conn.State == System.Data.ConnectionState.Open) { conn.Close(); } } return(ds); }
private DryadQueryNode VisitAssumeRangePartition(QueryNodeInfo source, LambdaExpression keySelectExpr, Expression keysExpr, Expression comparerExpr, Expression isDescendingExpr, Expression queryExpr) { DryadQueryNode child = this.Visit(source); Type keyType = keySelectExpr.Type.GetGenericArguments()[1]; if (comparerExpr == null && !TypeSystem.HasDefaultComparer(keyType)) { throw DryadLinqException.Create(HpcLinqErrorCode.ComparerMustBeSpecifiedOrKeyTypeMustBeIComparable, String.Format(SR.ComparerMustBeSpecifiedOrKeyTypeMustBeIComparable, keyType), queryExpr); } object comparer = null; if (comparerExpr != null) { ExpressionSimplifier<object> evaluator = new ExpressionSimplifier<object>(); comparer = evaluator.Eval(comparerExpr); } object keys = null; if (keysExpr != null) { ExpressionSimplifier<object> evaluator = new ExpressionSimplifier<object>(); keys = evaluator.Eval(keysExpr); } //count the number of keys provided. if (keys != null) { int nSeparators = 0; var ie = ((IEnumerable)keys).GetEnumerator(); while (ie.MoveNext()) { nSeparators++; } if (!child.IsDynamic && nSeparators != child.PartitionCount - 1) { throw DryadLinqException.Create( HpcLinqErrorCode.BadSeparatorCount, String.Format(SR.BadSeparatorCount, nSeparators, child.PartitionCount - 1), queryExpr); } } bool? isDescending = null; if (isDescendingExpr != null) { ExpressionSimplifier<bool> evaluator = new ExpressionSimplifier<bool>(); isDescending = evaluator.Eval(isDescendingExpr); } DataSetInfo outputInfo = new DataSetInfo(child.OutputDataSetInfo); outputInfo.partitionInfo = PartitionInfo.CreateRange(keySelectExpr, keys, comparer, isDescending, child.OutputPartition.Count, keyType); child.OutputDataSetInfo = outputInfo; return child; }
private DryadQueryNode VisitAssumeOrderBy(QueryNodeInfo source, LambdaExpression keySelectExpr, Expression comparerExpr, Expression isDescendingExpr, Expression queryExpr) { DryadQueryNode child = this.Visit(source); Type keyType = keySelectExpr.Type.GetGenericArguments()[1]; if (comparerExpr == null && !TypeSystem.HasDefaultComparer(keyType)) { throw DryadLinqException.Create(HpcLinqErrorCode.ComparerMustBeSpecifiedOrKeyTypeMustBeIComparable, String.Format(SR.ComparerMustBeSpecifiedOrKeyTypeMustBeIComparable, keyType), queryExpr); } object comparer = null; if (comparerExpr != null) { ExpressionSimplifier<object> evaluator = new ExpressionSimplifier<object>(); comparer = evaluator.Eval(comparerExpr); } ExpressionSimplifier<bool> bevaluator = new ExpressionSimplifier<bool>(); bool isDescending = bevaluator.Eval(isDescendingExpr); DataSetInfo outputInfo = new DataSetInfo(child.OutputDataSetInfo); outputInfo.orderByInfo = OrderByInfo.Create(keySelectExpr, comparer, isDescending, keyType); child.OutputDataSetInfo = outputInfo; return child; }
private DryadQueryNode VisitAssumeHashPartition(QueryNodeInfo source, LambdaExpression keySelectExpr, Expression keysExpr, Expression comparerExpr, Expression queryExpr) { DryadQueryNode child = this.Visit(source); Type keyType = keySelectExpr.Type.GetGenericArguments()[1]; if (comparerExpr == null && !TypeSystem.HasDefaultEqualityComparer(keyType)) { throw DryadLinqException.Create(HpcLinqErrorCode.ComparerMustBeSpecifiedOrKeyTypeMustBeIEquatable, String.Format(SR.ComparerMustBeSpecifiedOrKeyTypeMustBeIEquatable, keyType.FullName), queryExpr); } object comparer = null; if (comparerExpr != null) { ExpressionSimplifier<object> evaluator = new ExpressionSimplifier<object>(); comparer = evaluator.Eval(comparerExpr); } DataSetInfo outputInfo = new DataSetInfo(child.OutputDataSetInfo); outputInfo.partitionInfo = PartitionInfo.CreateHash(keySelectExpr, child.OutputPartition.Count, comparer, keyType); child.OutputDataSetInfo = outputInfo; return child; }
internal DLinqQueryNode(QueryNodeType nodeType, DryadLinqQueryGen queryGen, Expression queryExpr, params DLinqQueryNode[] children) { this.m_nodeType = nodeType; this.m_queryGen = queryGen; this.m_queryExpression = queryExpr; this.m_parents = new List<DLinqQueryNode>(1); this.m_children = children; foreach (DLinqQueryNode child in children) { child.Parents.Add(this); } this.m_superNode = null; this.m_isForked = false; this.m_uniqueId = DryadLinqQueryGen.StartPhaseId; this.m_channelType = ChannelType.DiskFile; this.m_conOpType = ConnectionOpType.Pointwise; this.m_opName = null; this.m_vertexEntryMethod = null; this.m_outputDataSetInfo = null; this.m_partitionCount = -1; this.m_dynamicManager = null; }
public ResolvedBinding(DataSetInfo dataSetInfo, DataBinding inner, int? externalIndex) : base(externalIndex, inner.Path) { this.dataSetInfo = dataSetInfo; this.inner = inner; }