<commit_before>{% macro adapter_macro(name) -%}
  {%- set separator = '__' -%}
  {%- set search_name = adapter.type() + separator + name -%}
  {%- set default_name = 'default' + separator + name -%}
  {%- if context.get(search_name) is not none -%}
    {{ context[search_name](*varargs, **kwargs) }}
  {%- else -%}
    {{ context[default_name](*varargs, **kwargs) }}
  {%- endif -%}
{%- endmacro %}

{% macro create_schema(schema_name) %}
  create schema if not exists "{{ schema_name }}";
{% endmacro %}


{% macro create_table_as(temporary, identifier, sql) -%}
  {{ adapter_macro('create_table_as', temporary, identifier, sql) }}
{%- endmacro %}

{% macro default__create_table_as(temporary, identifier, sql) -%}
  create {% if temporary: -%}temporary{%- endif %} table "{{ schema }}"."{{ identifier }}" as (
    {{ sql }}
  );
{% endmacro %}

{% macro create_view_as(identifier, sql) -%}
  {{ adapter_macro('create_view_as', identifier, sql) }}
{%- endmacro %}
<commit_msg>fix for adapter macro called within packages (#630)<commit_after>{% macro adapter_macro(name) -%}
  {% set original_name = name %}
  {% if '.' in name %}
    {% set package_name, name = name.split(".", 1) %}
  {% else %}
    {% set package_name = none %}
  {% endif %}

  {% if package_name is none %}
    {% set package_context = context %}
  {% elif package_name in context %}
    {% set package_context = context[package_name] %}
  {% else %}
    {% set error_msg %}
        In adapter_macro: could not find package '{{package_name}}', called with '{{original_name}}'
    {% endset %}
    {{ exceptions.raise_compiler_error(error_msg | trim) }}
  {% endif %}

  {%- set separator = '__' -%}
  {%- set search_name = adapter.type() + separator + name -%}
  {%- set default_name = 'default' + separator + name -%}

  {%- if package_context.get(search_name) is not none -%}
    {{ package_context[search_name](*varargs, **kwargs) }}
  {%- else -%}
    {{ package_context[default_name](*varargs, **kwargs) }}
  {%- endif -%}
{%- endmacro %}

{% macro create_schema(schema_name) %}
  create schema if not exists "{{ schema_name }}";
{% endmacro %}


{% macro create_table_as(temporary, identifier, sql) -%}
  {{ adapter_macro('create_table_as', temporary, identifier, sql) }}
{%- endmacro %}

{% macro default__create_table_as(temporary, identifier, sql) -%}
  create {% if temporary: -%}temporary{%- endif %} table "{{ schema }}"."{{ identifier }}" as (
    {{ sql }}
  );
{% endmacro %}

{% macro create_view_as(identifier, sql) -%}
  {{ adapter_macro('create_view_as', identifier, sql) }}
{%- endmacro %}

{'fraction_non_alphanumeric': 0.19403563129357088, 'fraction_numerical': 0.001549186676994578, 'mean_word_length': 3.901328273244782, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4665172', 'n_tokens_mistral': 961, 'n_tokens_neox': 842, 'n_words': 188}