当前位置: 首页>>代码示例>>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;未经允许,请勿转载。