方法过滤器的参数太多

时间:2017-06-22 19:05:57

标签: apache-spark

我在这里尝试的是过滤val sc1Rdd=parDf.select(parDf("token"),parDf("log_type")).rdd val sc2Rdd=sc1Rdd.filter(x=>x,log_type=="1") 的行 这是我的代码:

<div ng-controller="repeatPeople">
  <br>
  <p>
    <input type="text" id="search" ng-model="searchPeople" placeholder="Search">
  </p>
  <br>
  <br>
  <table border="0">
    <thead style="background-color: lightgray;">
      <tr>
        <td style="width: 30px;">Click</td>
        <td>Name</td>
        <td>Gender</td>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat-start="person in result = (people | filter:searchPeople)">
        <td>
          <button ng-if="person.expanded" ng-click="person.expanded = !person.expanded">-</button>
          <button ng-if="person.expanded == false" ng-click=" person.expanded = !person.expanded">+</button>
        </td>
        <td>{{person.name}}</td>
        <td>{{person.gender}}</td>
      </tr>
      <tr ng-if="person.expanded" ng-repeat-end="">
        <td colspan="3">{{person.details}}</td>
      </tr>
    </tbody>
  </table>
</div>

但错误代码显示:

  

parDf:org.apache.spark.sql.DataFrame = [action_time:bigint,   action_type:bigint ...另外21个字段] sc1Rdd:   org.apache.spark.rdd.RDD [org.apache.spark.sql.Row] =   MapPartitionsRDD [865] at rdd at:186:188:error:   方法过滤器的参数太多:(f:org.apache.spark.sql.Row =&gt;   布尔值)org.apache.spark.rdd.RDD [org.apache.spark.sql.Row]          val sc2Rdd = sc1Rdd.filter(x =&gt; x,log_type ==&#34; 1&#34;)

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您无需将数据框更改为RDD 你可以简单地过滤或在哪里

val result = parDf.select(parDf("token"),parDf("log_type")).filter(parDf("long_type")===1)

parDf.select(p===1)arDf("token"),parDf("log_type")).where(parDf("long_type") 

希望这有帮助!