Beispiel #1
0
go build && time ./_bm --command=vm --cpuprofile=cpu.prof
go tool pprof _bm cpu.prof


*/
var (
	cpuProfileFile string
	memProfileFile string
	logging        = "info"
	command        = "parse"

	msg = datasource.NewContextSimpleTs(
		map[string]value.Value{
			"int5":       value.NewIntValue(5),
			"item_count": value.NewStringValue("5"),
			"reg_date":   value.NewStringValue("2014/11/01"),
			"user_id":    value.NewStringValue("abc")},
		time.Now(),
	)
)

func init() {

	flag.StringVar(&logging, "logging", "info", "logging [ debug,info ]")
	flag.StringVar(&cpuProfileFile, "cpuprofile", "", "cpuprofile")
	flag.StringVar(&memProfileFile, "memprofile", "", "memProfileFile")
	flag.StringVar(&command, "command", "parse", "command to run [parse,vm]")
	flag.Parse()

	builtins.LoadAllBuiltins()
Beispiel #2
0
	"testing"
	"time"

	u "github.com/araddon/gou"
	"github.com/araddon/qlbridge/datasource"
	"github.com/araddon/qlbridge/value"
	"github.com/bmizerany/assert"
)

var (
	_    = u.EMPTY
	rows = []datasource.ContextReader{datasource.NewContextSimpleTs(
		map[string]value.Value{
			"int5":       value.NewIntValue(5),
			"item_count": value.NewStringValue("5"),
			"bval":       value.NewBoolValue(true),
			"bvalf":      value.NewBoolValue(false),
			"reg_date":   value.NewStringValue("2014/11/01"),
			"user_id":    value.NewStringValue("abc")},
		time.Now(),
	)}
)

func TestSqlSelectEval(t *testing.T) {
	wc := verifySql(t, `select 
		user_id
		, item_count * 2 as itemsx2
		, yy(reg_date) > 10 as regyy
		, 'literal' as lit_val 
	FROM stdio`, rows)
	wcAll := wc.All()
	assert.Tf(t, len(wcAll) == 4, "must have 4 fields: %v", wcAll)