<commit_before>/*
 * Copyright (c) 2014, Cloudera, Inc. All Rights Reserved.
 *
 * Cloudera, Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"). You may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for
 * the specific language governing permissions and limitations under the
 * License.
 */

package com.cloudera.oryx.lambda;

import com.cloudera.oryx.common.OryxTest;
import com.cloudera.oryx.common.settings.ConfigUtils;
import com.typesafe.config.Config;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.junit.Test;
import scala.Tuple2;

import java.util.HashMap;
import java.util.Map;

public final class WritableToValueFunctionTest extends OryxTest {

  @Test
  public void testFunction() {
    Map<String,String> overlayConfig = new HashMap<>();
    Config config = ConfigUtils.overlayOn(overlayConfig, ConfigUtils.getDefault());
    InputSerializationConfig batchSerConfig = new InputSerializationConfig(config);
    WritableToValueFunction<String,String> function =
        new WritableToValueFunction<>(String.class, String.class, batchSerConfig);
    Tuple2<Writable,Writable> in = new Tuple2<Writable,Writable>(new Text("bizz"), new Text("buzz"));
    Tuple2<String,String> out = function.call(in);
    assertEquals("bizz", out._1());
    assertEquals("buzz", out._2());<commit_msg>Rename a local variable too after last commit<commit_after>/*
 * Copyright (c) 2014, Cloudera, Inc. All Rights Reserved.
 *
 * Cloudera, Inc. licenses this file to you under the Apache License,
 * Version 2.0 (the "License"). You may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for
 * the specific language governing permissions and limitations under the
 * License.
 */

package com.cloudera.oryx.lambda;

import com.cloudera.oryx.common.OryxTest;
import com.cloudera.oryx.common.settings.ConfigUtils;
import com.typesafe.config.Config;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.junit.Test;
import scala.Tuple2;

import java.util.HashMap;
import java.util.Map;

public final class WritableToValueFunctionTest extends OryxTest {

  @Test
  public void testFunction() {
    Map<String,String> overlayConfig = new HashMap<>();
    Config config = ConfigUtils.overlayOn(overlayConfig, ConfigUtils.getDefault());
    InputSerializationConfig serializationConfig = new InputSerializationConfig(config);
    WritableToValueFunction<String,String> function =
        new WritableToValueFunction<>(String.class, String.class, serializationConfig);
    Tuple2<Writable,Writable> in = new Tuple2<Writable,Writable>(new Text("bizz"), new Text("buzz"));
    Tuple2<String,String> out = function.call(in);
    assertEquals("bizz", out._1());
    assertEquals("buzz", out._2());
{'fraction_non_alphanumeric': 0.10664229128580134, 'fraction_numerical': 0.008531383302864107, 'mean_word_length': 4.719512195121951, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1120026', 'n_tokens_mistral': 963, 'n_tokens_neox': 952, 'n_words': 290}