<commit_before>package compile

import (
	"strconv"

	"github.com/jimmyfrasche/etlite/internal/ast"
	"github.com/jimmyfrasche/etlite/internal/internal/errint"
	"github.com/jimmyfrasche/etlite/internal/virt"
)

func (c *compiler) compileSQL(s *ast.SQL) {
	switch s.Kind {
	default:
		panic(errint.Newf("got unknown or invalid sql kind %d", s.Kind))
	case ast.Savepoint, ast.Release, ast.BeginTransaction, ast.Commit:
		if ls := len(s.Subqueries); ls != 0 {
			panic(errint.Newf("%s cannot have etl subqueries, found %d", s.Kind, ls))
		}
		c.compileTransactor(s)
	case ast.CreateTableFrom, ast.CreateTableAs, ast.InsertFrom:
		if ls := len(s.Subqueries); ls != 1 {
			panic(errint.Newf("%s must have exactly 1 etl subquery, found %d", s.Kind, ls))
		}
	case ast.Exec, ast.Query:
		//can have any number
	}

	switch s.Kind {
	case ast.CreateTableFrom, ast.InsertFrom: //TODO should collect columns in parser<commit_msg>removed out of date TODO<commit_after>package compile

import (
	"strconv"

	"github.com/jimmyfrasche/etlite/internal/ast"
	"github.com/jimmyfrasche/etlite/internal/internal/errint"
	"github.com/jimmyfrasche/etlite/internal/virt"
)

func (c *compiler) compileSQL(s *ast.SQL) {
	switch s.Kind {
	default:
		panic(errint.Newf("got unknown or invalid sql kind %d", s.Kind))
	case ast.Savepoint, ast.Release, ast.BeginTransaction, ast.Commit:
		if ls := len(s.Subqueries); ls != 0 {
			panic(errint.Newf("%s cannot have etl subqueries, found %d", s.Kind, ls))
		}
		c.compileTransactor(s)
	case ast.CreateTableFrom, ast.CreateTableAs, ast.InsertFrom:
		if ls := len(s.Subqueries); ls != 1 {
			panic(errint.Newf("%s must have exactly 1 etl subquery, found %d", s.Kind, ls))
		}
	case ast.Exec, ast.Query:
		//can have any number
	}

	switch s.Kind {
	case ast.CreateTableFrom, ast.InsertFrom:
{'fraction_non_alphanumeric': 0.1407202216066482, 'fraction_numerical': 0.0033240997229916896, 'mean_word_length': 4.26530612244898, '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': '2323602', 'n_tokens_mistral': 727, 'n_tokens_neox': 679, 'n_words': 161}