當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript AttributeInfo.fromJS方法代碼示例

本文整理匯總了TypeScript中plywood.AttributeInfo.fromJS方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript AttributeInfo.fromJS方法的具體用法?TypeScript AttributeInfo.fromJS怎麽用?TypeScript AttributeInfo.fromJS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在plywood.AttributeInfo的用法示例。


在下文中一共展示了AttributeInfo.fromJS方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('works with max', () => {
   var attribute = AttributeInfo.fromJS({
     "name": "unique_page",
     "special": "unique",
     "type": "STRING"
   });
   var measures = Measure.measuresFromAttributeInfo(attribute).map((m => m.toJS()));
   expect(measures).to.deep.equal([
     {
       "expression": {
         "action": {
           "action": "countDistinct",
           "expression": {
             "name": "unique_page",
             "op": "ref"
           }
         },
         "expression": {
           "name": "main",
           "op": "ref"
         },
         "op": "chain"
       },
       "name": "unique_page",
       "title": "Unique Page"
     }
   ]);
 });
開發者ID:coconutpalm,項目名稱:pivot,代碼行數:28,代碼來源:measure.mocha.ts

示例2: it

 it('works with histogram', () => {
   var attribute = AttributeInfo.fromJS({
     "name": "delta_hist",
     "special": "histogram",
     "type": "NUMBER"
   });
   var measures = Measure.measuresFromAttributeInfo(attribute).map((m => m.toJS()));
   expect(measures).to.deep.equal([]);
 });
開發者ID:codeaudit,項目名稱:pivot,代碼行數:9,代碼來源:measure.mocha.ts

示例3:

 return introspectedExternalPromise.then((introspectedExternal) => {
   var attributes = introspectedExternal.attributes;
   for (var attribute of attributes) {
     // This is a metric that should really be a HLL
     if (attribute.type === 'NUMBER' && countDistinctReferences.indexOf(attribute.name) !== -1) {
       introspectedExternal = introspectedExternal.updateAttribute(AttributeInfo.fromJS({
         name: attribute.name,
         special: 'unique'
       }));
     }
   }
   return introspectedExternal;
 });
開發者ID:coconutpalm,項目名稱:pivot,代碼行數:13,代碼來源:executor.ts

示例4: it

 it('works with theta', () => {
   var attribute = AttributeInfo.fromJS({
     "name": "page_theta",
     "special": "theta",
     "type": "STRING"
   });
   var measures = Measure.measuresFromAttributeInfo(attribute).map((m => m.toJS()));
   expect(measures).to.deep.equal([
     {
       "name": "page_theta",
       "title": "Page Theta",
       "formula": "$main.countDistinct($page_theta)"
     }
   ]);
 });
開發者ID:djfwan,項目名稱:pivot,代碼行數:15,代碼來源:measure.mocha.ts

示例5: it

    it("works in basic case (no count)", () => {
      var dataSourceStub = DataSource.fromJS({
        name: 'wiki',
        title: 'Wiki',
        engine: 'druid',
        source: 'wiki',
        subsetFilter: null,
        introspection: 'autofill-all',
        defaultTimezone: 'Etc/UTC',
        defaultFilter: { op: 'literal', value: true },
        defaultPinnedDimensions: [],
        refreshRule: {
          refresh: "PT1M",
          rule: "fixed"
        }
      });

      var attributes = [
        AttributeInfo.fromJS({ name: '__time', type: 'TIME' }),
        AttributeInfo.fromJS({ name: 'page', type: 'STRING' }),
        AttributeInfo.fromJS({ name: 'added', type: 'NUMBER' }),
        AttributeInfo.fromJS({ name: 'unique_user', special: 'unique' })
      ];

      expect(dataSourceStub.setAttributes(attributes).toJS()).to.deep.equal(
        {
          "name": "wiki",
          "title": "Wiki",
          "engine": "druid",
          "source": "wiki",
          "refreshRule": {
            "refresh": "PT1M",
            "rule": "fixed"
          },
          "subsetFilter": null,
          "defaultDuration": "P1D",
          "defaultFilter": { "op": "literal", "value": true },
          "defaultPinnedDimensions": [],
          "defaultSortMeasure": "added",
          "defaultTimezone": "Etc/UTC",
          "introspection": "no-autofill",
          "timeAttribute": '__time',
          "attributes": [
            { name: '__time', type: 'TIME' },
            { name: 'page', type: 'STRING' },
            { name: 'added', type: 'NUMBER' },
            { name: 'unique_user', special: 'unique', "type": "STRING" }
          ],
          "dimensions": [
            {
              "expression": {
                "name": "__time",
                "op": "ref"
              },
              "kind": "time",
              "name": "__time",
              "title": "Time"
            },
            {
              "expression": {
                "name": "page",
                "op": "ref"
              },
              "kind": "string",
              "name": "page",
              "title": "Page"
            }
          ],
          "measures": [
            {
              "expression": {
                "action": {
                  "action": "sum",
                  "expression": {
                    "name": "added",
                    "op": "ref"
                  }
                },
                "expression": {
                  "name": "main",
                  "op": "ref"
                },
                "op": "chain"
              },
              "name": "added",
              "title": "Added"
            },
            {
              "expression": {
                "action": {
                  "action": "countDistinct",
                  "expression": {
                    "name": "unique_user",
                    "op": "ref"
                  }
                },
                "expression": {
                  "name": "main",
                  "op": "ref"
                },
//.........這裏部分代碼省略.........
開發者ID:codeaudit,項目名稱:pivot,代碼行數:101,代碼來源:data-source.mocha.ts


注:本文中的plywood.AttributeInfo.fromJS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。