<commit_before>package main

import (
	"fmt"
	// "github.com/eaciit/toolkit"
	. "github.com/frezadev/hdc/hive"
	// "reflect"
	// "os"
)

var fnHR FnHiveReceive
var h *Hive

type Sample7 struct {
	Code        string `tag_name:"code"`
	Description string `tag_name:"description"`
	Total_emp   string `tag_name:"total_emp"`
	Salary      string `tag_name:"salary"`
}

func main() {
	var e error
	h = HiveConfig("192.168.0.223:10000", "default", "developer", "b1gD@T@")
	q := "select * from sample_07 limit 5;"

	/*fmt.Println("---------------------- EXEC ----------------")
	result, e := h.Exec(q)

	fmt.Printf("error: \n%v\n", e)

	for _, res := range result {
		tmp := Sample7{}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	}*/

	fmt.Println("---------------------- EXEC LINE ----------------")

	//to execute query and read the result per line and then process its result

	/*var DoSomething = func(res string) {
		tmp := Sample7{}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	}*/

	e = h.ExecLine(q, func(res string) {
		tmp := Sample7{}
		h.Header = []string{"code", "description", "total_emp", "salary"}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	})
	fmt.Printf("error: \n%v\n", e)

	// test := "00-0000,All Occupations,134354250,40690"

	/*var x = Sample7{}
	var z interface{}
	z = x
	s := reflect.ValueOf(&z).Elem()
	typeOfT := s.Type()
	fmt.Println(reflect.ValueOf(&z).Interface())
	for i := 0; i < s.NumField(); i++ {
		f := s.Field(i)
		tag := s.Type().Field(i).Tag
		fmt.Printf("%d: %s %s = %v | tag %s \n", i, typeOfT.Field(i).Name, f.Type(), f.Interface(), tag.Get("tag_name"))

	}*/

	/*h = HiveConfig("192.168.0.223:10000", "default", "developer", "b1gD@T@")
	h.Header = []string{"code", "description", "total_emp", "salary"}<commit_msg>bug fixing<commit_after>package main

import (
	"fmt"
	// "github.com/eaciit/toolkit"
	. "github.com/frezadev/hdc/hive"
	// "reflect"
	// "os"
)

var fnHR FnHiveReceive
var h *Hive

type Sample7 struct {
	Code        string `tag_name:"code"`
	Description string `tag_name:"description"`
	Total_emp   string `tag_name:"total_emp"`
	Salary      string `tag_name:"salary"`
}

func main() {
	var e error
	h = HiveConfig("192.168.0.223:10000", "default", "developer", "b1gD@T@")
	q := "select * from sample_07 limit 5;"

	/*fmt.Println("---------------------- EXEC ----------------")
	result, e := h.Exec(q)

	fmt.Printf("error: \n%v\n", e)

	for _, res := range result {
		tmp := Sample7{}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	}*/

	fmt.Println("---------------------- EXEC LINE ----------------")

	//to execute query and read the result per line and then process its result

	/*var DoSomething = func(res string) {
		tmp := Sample7{}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	}*/

	e = h.ExecLine(q, func(res string) {
		tmp := Sample7{}
		h.ParseOutput(res, &tmp)
		fmt.Println(tmp)
	})
	fmt.Printf("error: \n%v\n", e)

	// test := "00-0000,All Occupations,134354250,40690"

	/*var x = Sample7{}
	var z interface{}
	z = x
	s := reflect.ValueOf(&z).Elem()
	typeOfT := s.Type()
	fmt.Println(reflect.ValueOf(&z).Interface())
	for i := 0; i < s.NumField(); i++ {
		f := s.Field(i)
		tag := s.Type().Field(i).Tag
		fmt.Printf("%d: %s %s = %v | tag %s \n", i, typeOfT.Field(i).Name, f.Type(), f.Interface(), tag.Get("tag_name"))

	}*/

	/*h = HiveConfig("192.168.0.223:10000", "default", "developer", "b1gD@T@")
	h.Header = []string{"code", "description", "total_emp", "salary"}
{'fraction_non_alphanumeric': 0.23787394713912285, 'fraction_numerical': 0.03543421434795237, 'mean_word_length': 3.0280701754385966, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '5666497', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1344, 'n_words': 301}