user3294904
user3294904

Reputation: 454

UDF in bigquery error

I am running below simple UDF and I am getting "Error: 3.3 - 14.6: Javascript TVFs are disabled.". Does anyone have a clue about this?

Query:

select * from 
js(
(publicdata:samples.shakespeare),
word, word_count,
"[{name: 'word', type:'string'},
  {name: 'add5', type:'integer'}]",

  "function(r, emit) {
   var new_cnt = r.word_count+5;
   emit({word: r.word, 
         add5: new_cnt});  
  }")

Upvotes: 2

Views: 2068

Answers (1)

Felipe Hoffa
Felipe Hoffa

Reputation: 59165

"function(r, emit) {
   var new_cnt = r.word_count+5;
   emit({word: r.word, 
         add5: new_cnt});  
  }"

This function is a new way to write Javascript inside BigQuery SQL statements. Unfortunately this feature is still in development (today being January 2015), and not widely available.

Upvotes: 1

Related Questions