<commit_before>package net.q3aiml.dbdata.config;

import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.InjectableValues;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.google.common.collect.ImmutableMap;
import net.q3aiml.dbdata.model.DatabaseMetadata;
import net.q3aiml.dbdata.model.ForeignKeyReference;
import net.q3aiml.dbdata.model.Table;

import java.io.IOException;
import java.util.*;
import java.util.stream.Stream;

public class DatabaseConfig {
    public static DatabaseConfig fromYaml(String yaml, DatabaseMetadata db) throws IOException {
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        mapper.setInjectableValues(new InjectableValues.Std(ImmutableMap.of(
                "metadata", db
        )));
        return mapper.readValue(yaml, DatabaseConfig.class);
    }

    @JacksonInject("metadata")
    public DatabaseMetadata databaseMetadata;

    @JsonProperty("schema")
    public String schema;

    @JsonProperty("tables")
    public Map<String, DatabaseTableConfig> tableConfigs = new HashMap<>();

    @JsonProperty("global")
    public DatabaseTableConfig globalConfig = new DatabaseTableConfig();

    @JsonProperty("rekeyer")
    public RekeyerConfig rekeyer = new RekeyerConfig();

    @JsonProperty("foreign_keys")
    public List<ForeignKeyReference> foreignKeys = new ArrayList<>();

    public boolean isIgnored(Table table, String columnName) {<commit_msg>fix NPE in exporter, failing test<commit_after>package net.q3aiml.dbdata.config;

import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.InjectableValues;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.google.common.collect.ImmutableMap;
import net.q3aiml.dbdata.model.DatabaseMetadata;
import net.q3aiml.dbdata.model.ForeignKeyReference;
import net.q3aiml.dbdata.model.Table;

import java.io.IOException;
import java.util.*;
import java.util.stream.Stream;

public class DatabaseConfig {
    public static DatabaseConfig fromYaml(String yaml, DatabaseMetadata db) throws IOException {
        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
        mapper.setInjectableValues(new InjectableValues.Std(ImmutableMap.of(
                "metadata", db
        )));
        return mapper.readValue(yaml, DatabaseConfig.class);
    }

    @JacksonInject("metadata")
    public DatabaseMetadata databaseMetadata = new DatabaseMetadata();

    @JsonProperty("schema")
    public String schema;

    @JsonProperty("tables")
    public Map<String, DatabaseTableConfig> tableConfigs = new HashMap<>();

    @JsonProperty("global")
    public DatabaseTableConfig globalConfig = new DatabaseTableConfig();

    @JsonProperty("rekeyer")
    public RekeyerConfig rekeyer = new RekeyerConfig();

    @JsonProperty("foreign_keys")
    public List<ForeignKeyReference> foreignKeys = new ArrayList<>();

    public boolean isIgnored(Table table, String columnName) {
{'fraction_non_alphanumeric': 0.09853445587776738, 'fraction_numerical': 0.002494543186778921, 'mean_word_length': 4.886238532110092, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '3953486', 'n_tokens_mistral': 925, 'n_tokens_neox': 866, 'n_words': 185}