text:
Bigquery Query Like  ORDER BY GROUP BY FORMAT_DATE count and subquery not working on bigquery emulator.

Hey @goccy
I have written one query regarding BIG QUERY Like the below for inserting data and fetching data
Whenever insert data it will work fine but when I tried to fetch data using group by or count or order by or using subquery it will not give me a proper record and it will give me error.
This is below code I tried.
type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

ctx := context.Background()
	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := bigQueryClient.Dataset("dataset").Create(ctx, meta); err != nil {
		return
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := bigQueryClient.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		return
	}

	inserter := bigQueryClient.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		fmt.Println("err=>", err)
		return
	}

While I try to fetch the record using the below query it is not working
HERE THIS QUERY WILL NOT WORKING
SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', STRING(created))) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE created BETWEEN '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
						 AND installid IS NOT NULL AND length(installid) > 0
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key

It will give me the error  panic: runtime error: invalid memory address or nil pointer dereference [recovered]
Whenever I run this SIMPLE query it will give me 11 records and its works fine but whenever I run the above query it would not work yet.
rows := bigQueryClient.Query(`
			SELECT *
			FROM ` + "`test.dataset.table`" + `
	`)

	it, err := rows.Read(ctx)
	fmt.Println("TOTAL ROWS COUNT", it.TotalRows)

// OUTPUT  : TOTAL ROWS COUNT 11
Please suggest me proper solution for the above query
Thank you @goccy

I wrote a test code and verified it, and the result is different from what you reported.
package server_test

import (
	"context"
	"fmt"
	"testing"
	"time"

	"cloud.google.com/go/bigquery"
	"github.com/goccy/bigquery-emulator/server"
	"github.com/goccy/bigquery-emulator/types"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
)

type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

func TestHoge(t *testing.T) {
	ctx := context.Background()

	bqServer, err := server.New(server.TempStorage)
	if err != nil {
		t.Fatal(err)
	}
	if err := bqServer.Load(server.StructSource(types.NewProject("test"))); err != nil {
		t.Fatal(err)
	}
	testServer := bqServer.TestServer()
	defer func() {
		testServer.Close()
		bqServer.Close()
	}()

	client, err := bigquery.NewClient(
		ctx,
		"test",
		option.WithEndpoint(testServer.URL),
		option.WithoutAuthentication(),
	)
	if err != nil {
		t.Fatal(err)
	}
	defer client.Close()

	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := client.Dataset("dataset").Create(ctx, meta); err != nil {
		t.Fatal(err)
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := client.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		t.Fatal(err)
	}

	inserter := client.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		t.Fatal(err)
	}

	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', STRING(created))) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE created BETWEEN '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
						 AND installid IS NOT NULL AND length(installid) > 0
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`
	query2 := "SELECT * FROM `test.dataset.table`"
	_ = query2
	it, err := client.Query(query).Read(ctx)
	if err != nil {
		t.Fatal(err)
	}
	for {
		var row []bigquery.Value
		if err := it.Next(&row); err != nil {
			if err == iterator.Done {
				break
			}
			t.Fatal(err)
		}
		fmt.Println("row = ", row)
	}
	fmt.Println("TOTAL ROWS COUNT", it.TotalRows)
}

First, the result of executing query2 in the above test code is as follows. this seems to work as expected.
row =  [1bjCljWkq6tinyAMuu0tEAhB80 Phrased Flintstones0 Phrased Flintstones0 Phrased Flintstones0 license-request 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB81 Phrased Flintstones1 Phrased Flintstones1 Phrased Flintstones1 camera 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB82 Phrased Flintstones2 Phrased Flintstones2 Phrased Flintstones2 activation 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB83 Phrased Flintstones3 Phrased Flintstones3 Phrased Flintstones3 textsearch 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB84 Phrased Flintstones4 Phrased Flintstones4 Phrased Flintstones4 barcode 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB85 Phrased Flintstones5 Phrased Flintstones5 Phrased Flintstones5 ocr 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB86 Phrased Flintstones6 Phrased Flintstones6 Phrased Flintstones6 fooddetection 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB87 Phrased Flintstones7 Phrased Flintstones7 Phrased Flintstones7 classifications 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB88 Phrased Flintstones8 Phrased Flintstones8 Phrased Flintstones8 customdetection 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB89 Phrased Flintstones9 Phrased Flintstones9 Phrased Flintstones9 detectinimage 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB89 Phrased Flintstones9 Phrased Flintstones10 Phrased Flintstones10 packagedfood 1 2022-10-11T17:31:39]
TOTAL ROWS COUNT 11

Then I ran query . The result is as follows. This query has been marked as an invalid query by ZetaSQL Analyzer.
Did it work with BigQuery ?
googleapi: Error 400: INVALID_ARGUMENT: No matching signature for operator BETWEEN for argument types: STRING, STRING, DATE. Supported signatures: (INT64) BETWEEN (UINT64) AND (UINT64); (UINT64) BETWEEN (INT64) AND (UINT64); (UINT64) BETWEEN (UINT64) AND (INT64); (UINT64) BETWEEN (INT64) AND (INT64); (INT64) BETWEEN (UINT64) AND (INT64); (INT64) BETWEEN (INT64) AND (UINT64); (ANY) BETWEEN (ANY) AND (ANY) [at 6:55], jobInternalError

@goccy
Thanks for the quick response
Could you please try with a single query?
SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', STRING(created))) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE created BETWEEN '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
						 AND installid IS NOT NULL AND length(installid) > 0
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key

Yes @goccy
It will work fine in bigquery
Currently, I am working on a big query test case so I tried your library big query emulator for the implementation of big query test cases (big query emulator)

@goccy
I am getting the below error could you please suggest me?
googleapi: Error 400: INVALID_ARGUMENT: Table not found: test [at 5:46], jobInternalError

Hi @Vikas-MI
Could you share how to new bigquery client with me? I'm stuck on create any dateset in my mock server. I always got some  error message like Post "http://0.0.0.0:55189/projects/test/datasets?alt=json&prettyPrint=false": EOF

I wrote a test code and verified it, and the result is different from what you reported.
package server_test

import (
	"context"
	"fmt"
	"testing"
	"time"

	"cloud.google.com/go/bigquery"
	"github.com/goccy/bigquery-emulator/server"
	"github.com/goccy/bigquery-emulator/types"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
)

type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

func TestHoge(t *testing.T) {
	ctx := context.Background()

	bqServer, err := server.New(server.TempStorage)
	if err != nil {
		t.Fatal(err)
	}
	if err := bqServer.Load(server.StructSource(types.NewProject("test"))); err != nil {
		t.Fatal(err)
	}
	testServer := bqServer.TestServer()
	defer func() {
		testServer.Close()
		bqServer.Close()
	}()

	client, err := bigquery.NewClient(
		ctx,
		"test",
		option.WithEndpoint(testServer.URL),
		option.WithoutAuthentication(),
	)
	if err != nil {
		t.Fatal(err)
	}
	defer client.Close()

	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := client.Dataset("dataset").Create(ctx, meta); err != nil {
		t.Fatal(err)
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := client.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		t.Fatal(err)
	}

	inserter := client.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		t.Fatal(err)
	}

	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', STRING(created))) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE created BETWEEN '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
						 AND installid IS NOT NULL AND length(installid) > 0
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`
	query2 := "SELECT * FROM `test.dataset.table`"
	_ = query2
	it, err := client.Query(query).Read(ctx)
	if err != nil {
		t.Fatal(err)
	}
	for {
		var row []bigquery.Value
		if err := it.Next(&row); err != nil {
			if err == iterator.Done {
				break
			}
			t.Fatal(err)
		}
		fmt.Println("row = ", row)
	}
	fmt.Println("TOTAL ROWS COUNT", it.TotalRows)
}

First, the result of executing query2 in the above test code is as follows. this seems to work as expected.
row =  [1bjCljWkq6tinyAMuu0tEAhB80 Phrased Flintstones0 Phrased Flintstones0 Phrased Flintstones0 license-request 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB81 Phrased Flintstones1 Phrased Flintstones1 Phrased Flintstones1 camera 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB82 Phrased Flintstones2 Phrased Flintstones2 Phrased Flintstones2 activation 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB83 Phrased Flintstones3 Phrased Flintstones3 Phrased Flintstones3 textsearch 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB84 Phrased Flintstones4 Phrased Flintstones4 Phrased Flintstones4 barcode 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB85 Phrased Flintstones5 Phrased Flintstones5 Phrased Flintstones5 ocr 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB86 Phrased Flintstones6 Phrased Flintstones6 Phrased Flintstones6 fooddetection 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB87 Phrased Flintstones7 Phrased Flintstones7 Phrased Flintstones7 classifications 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB88 Phrased Flintstones8 Phrased Flintstones8 Phrased Flintstones8 customdetection 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB89 Phrased Flintstones9 Phrased Flintstones9 Phrased Flintstones9 detectinimage 1 2022-10-11T17:31:39]
row =  [1bjCljWkq6tinyAMuu0tEAhB89 Phrased Flintstones9 Phrased Flintstones10 Phrased Flintstones10 packagedfood 1 2022-10-11T17:31:39]
TOTAL ROWS COUNT 11

Then I ran query . The result is as follows. This query has been marked as an invalid query by ZetaSQL Analyzer. Did it work with BigQuery ?
googleapi: Error 400: INVALID_ARGUMENT: No matching signature for operator BETWEEN for argument types: STRING, STRING, DATE. Supported signatures: (INT64) BETWEEN (UINT64) AND (UINT64); (UINT64) BETWEEN (INT64) AND (UINT64); (UINT64) BETWEEN (UINT64) AND (INT64); (UINT64) BETWEEN (INT64) AND (INT64); (INT64) BETWEEN (UINT64) AND (INT64); (INT64) BETWEEN (INT64) AND (UINT64); (ANY) BETWEEN (ANY) AND (ANY) [at 6:55], jobInternalError

Hi @goccy
Yes I get exactly the same error as you getting
Could you please suggest to me the proper solution for it?
googleapi: Error 400: INVALID_ARGUMENT: No matching signature for operator BETWEEN for argument types: STRING, STRING, DATE. Supported signatures: (INT64) BETWEEN (UINT64) AND (UINT64); (UINT64) BETWEEN (INT64) AND (UINT64); (UINT64) BETWEEN (UINT64) AND (INT64); (UINT64) BETWEEN (INT64) AND (INT64); (INT64) BETWEEN (UINT64) AND (INT64); (INT64) BETWEEN (INT64) AND (UINT64); (ANY) BETWEEN (ANY) AND (ANY) [at 6:55], jobInternalError

Hi @goccy
Could you please help me out with this query solution?
Because I am also getting the same error as you getting
googleapi: Error 400: INVALID_ARGUMENT: No matching signature for operator BETWEEN for argument types: STRING, STRING, DATE. Supported signatures: (INT64) BETWEEN (UINT64) AND (UINT64); (UINT64) BETWEEN (INT64) AND (UINT64); (UINT64) BETWEEN (UINT64) AND (INT64); (UINT64) BETWEEN (INT64) AND (INT64); (INT64) BETWEEN (UINT64) AND (INT64); (INT64) BETWEEN (INT64) AND (UINT64); (ANY) BETWEEN (ANY) AND (ANY) [at 6:47], jobInternalError

After correcting the casting process for PARSE_DATETIME argument and created which is the argument of BETWEEN, the error is gone, but I found that the converted query fails due to a bug in go-zetasqlite.
I'm currently working on fixing that.
	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', created)) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE DATE(created) BETWEEN DATE '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`

Hey @goccy
Yes Thank you so much for your response
Currently, I get this below error like
googleapi: Error 400: failed to parse statements: failed to parse statement: INVALID_ARGUMENT: Syntax error: Illegal input character "%" [type.googleapis.com/zetasql.ErrorLocation='\x08\x04\x10Y'], jobInternalError

@Vikas-MI Based on the error, I would guess that your code is most likely incorrect, so please paste the code you are verifying as is here.

After correcting the casting process for PARSE_DATETIME argument and created which is the argument of BETWEEN, the error is gone, but I found that the converted query fails due to a bug in go-zetasqlite. I'm currently working on fixing that.
	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', created)) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE DATE(created) BETWEEN DATE '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`

Hey
@goccy
Could you please send me the error which you are getting in this query?

I confirmed this problem was fixed with #67 .
Test code is here. ( put to server directory )
package server_test

import (
	"context"
	"fmt"
	"testing"
	"time"

	"cloud.google.com/go/bigquery"
	"github.com/goccy/bigquery-emulator/server"
	"github.com/goccy/bigquery-emulator/types"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
)

type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

func TestIssue59(t *testing.T) {
	ctx := context.Background()

	bqServer, err := server.New(server.TempStorage)
	if err != nil {
		t.Fatal(err)
	}
	if err := bqServer.Load(server.StructSource(types.NewProject("test"))); err != nil {
		t.Fatal(err)
	}
	testServer := bqServer.TestServer()
	defer func() {
		testServer.Close()
		bqServer.Close()
	}()

	client, err := bigquery.NewClient(
		ctx,
		"test",
		option.WithEndpoint(testServer.URL),
		option.WithoutAuthentication(),
	)
	if err != nil {
		t.Fatal(err)
	}
	defer client.Close()

	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := client.Dataset("dataset").Create(ctx, meta); err != nil {
		t.Fatal(err)
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := client.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		t.Fatal(err)
	}

	inserter := client.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		t.Fatal(err)
	}

	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', created)) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE DATE(created) BETWEEN DATE '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`
	it, err := client.Query(query).Read(ctx)
	if err != nil {
		t.Fatal(err)
	}
	for {
		var row []bigquery.Value
		if err := it.Next(&row); err != nil {
			if err == iterator.Done {
				break
			}
			t.Fatal(err)
		}
		fmt.Println("row = ", row)
	}
	fmt.Println("TOTAL ROWS COUNT", it.TotalRows)
}

go test -v ./server -run TestIssue59

@Vikas-MI
I released v0.1.20 to fix this problem.
Could you please confirm the above test code ?

I will close this once. If you still have problems, let me know.

@goccy Thank you for your quick response
But after scanning the result I get this below error could you please look at this issue?
error => googleapi: Error 404: dataset anonymous is not found, notFound

I've never encountered that error, so I need the complete code to reproduce.

@goccy
This is my code

type uses struct {
	id *uuid.UUID `json:"id"`
	Name       string     `json:"name"`
	Lid  *uuid.UUID `json:"lid"`
	Key        string     `json:"key"`
	YearMonth  string     `json:"year_month"`
	Count      int        `json:"count"`
}

var rows *bigquery.RowIterator

rows, err := bigQueryClient.Query(query).Read(ctx)

        fmt.Println("rows", rows)
	var usesList []*model.uses

	for {
		uses := model.uses{}

		err := rows.Next(&uses)
		if err == iterator.Done {
			break
		}
		if err != nil {
			fmt.Println("err", err)
			return nil, fmt.Errorf("error reading list Data. Err: %v", err)
		}
		usesList = append(usesList, &uses)
	}
	return usesList, nil

@goccy Could you please run this above code in your editor and could you please let me know if you are getting any errors or not?

The code you provided is incomplete so I can't try it.

Hey @goccy let me share you full code.

The code you're providing is incomplete Go code. Please paste here the complete code that works just by pasting it into the editor. Otherwise I cannot investigate.

package server_test

import (
	"context"
	"fmt"
	"testing"
	"time"

	"cloud.google.com/go/bigquery"
	"github.com/goccy/bigquery-emulator/server"
	"github.com/goccy/bigquery-emulator/types"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
)

type uses struct {
	id *uuid.UUID `json:"id"`
	Name       string     `json:"name"`
	Lid        *uuid.UUID `json:"lid"`
	Key        string     `json:"key"`
	YearMonth  string     `json:"year_month"`
	Count      int        `json:"count"`
}

type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

func TestIssue59(t *testing.T) {
	ctx := context.Background()

	bqServer, err := server.New(server.TempStorage)
	if err != nil {
		t.Fatal(err)
	}
	if err := bqServer.Load(server.StructSource(types.NewProject("test"))); err != nil {
		t.Fatal(err)
	}
	testServer := bqServer.TestServer()
	defer func() {
		testServer.Close()
		bqServer.Close()
	}()

	client, err := bigquery.NewClient(
		ctx,
		"test",
		option.WithEndpoint(testServer.URL),
		option.WithoutAuthentication(),
	)
	if err != nil {
		t.Fatal(err)
	}
	defer client.Close()

	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := client.Dataset("dataset").Create(ctx, meta); err != nil {
		t.Fatal(err)
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := client.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		t.Fatal(err)
	}

	inserter := client.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		t.Fatal(err)
	}

	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', created)) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE DATE(created) BETWEEN DATE '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`

        var rows *bigquery.RowIterator
	rows, err := client.Query(query).Read(ctx)
	if err != nil {
		t.Fatal(err)
	}
        fmt.Println("rows", rows)
	var usesList []*model.uses

	for {
		uses := model.uses{}

		err := rows.Next(&uses)
		if err == iterator.Done {
			break
		}
		if err != nil {
			fmt.Println("err", err)
                         //================================================================

                         //HERE I AM GETTING googleapi: Error 404: dataset anonymous is not found, notFound

                         //================================================================
			return nil, fmt.Errorf("error reading list Data. Err: %v", err)
		}
		usesList = append(usesList, &uses)
	}
	return usesList, nil
}

Thank you so much for your quick response
I have update the updated code here could you please check it again ? @goccy

Did you run this test code even once ? Go compiler can't compile this test code.
I'm sorry, but I will not investigate if you do not give me a code that I can compile next time, because the way you have been asking me to investigate in the past has not been good.

Okay @goccy sure.

The your pasted code is invalid at this time. Support will be finished.
https://github.com/goccy/bigquery-emulator/issues/59#issuecomment-1301960304

package main

import (
	"context"
	"fmt"
	"github.com/gofrs/uuid"
	"testing"
	"time"

	"cloud.google.com/go/bigquery"
	"github.com/goccy/bigquery-emulator/server"
	"github.com/goccy/bigquery-emulator/types"
	"google.golang.org/api/iterator"
	"google.golang.org/api/option"
)

type uses struct {
	id        *uuid.UUID `json:"id"`
	Name      string     `json:"name"`
	Lid       *uuid.UUID `json:"lid"`
	Key       string     `json:"key"`
	YearMonth string     `json:"year_month"`
	Count     int        `json:"count"`
}

type MockUsageEvent struct {
	Key       string `json:"key" binding:"required" conform:"trim"`
	Product   string `json:"product" conform:"trim"`
	Version   string `json:"version" conform:"trim"`
	Platform  string `json:"platform" conform:"trim"`
	Event     string `json:"event" binding:"required,oneofCI=activation" conform:"trim,lower"`
	InstallId string `json:"installid" conform:"trim"`
	Created   string `json:"created"`
}

func (i *MockUsageEvent) Save() (map[string]bigquery.Value, string, error) {
	return map[string]bigquery.Value{
		"key":       i.Key,
		"product":   i.Product,
		"version":   i.Version,
		"platform":  i.Platform,
		"event":     i.Event,
		"installid": i.InstallId,
		"created":   i.Created,
	}, bigquery.NoDedupeID, nil
}

func TestIssue59(t *testing.T) {
	ctx := context.Background()

	bqServer, err := server.New(server.TempStorage)
	if err != nil {
		t.Fatal(err)
	}
	if err := bqServer.Load(server.StructSource(types.NewProject("test"))); err != nil {
		t.Fatal(err)
	}
	testServer := bqServer.TestServer()
	defer func() {
		testServer.Close()
		bqServer.Close()
	}()

	client, err := bigquery.NewClient(
		ctx,
		"test",
		option.WithEndpoint(testServer.URL),
		option.WithoutAuthentication(),
	)
	if err != nil {
		t.Fatal(err)
	}
	defer client.Close()

	meta := &bigquery.DatasetMetadata{
		Location: "US", // See https://cloud.google.com/bigquery/docs/locations
	}
	if err := client.Dataset("dataset").Create(ctx, meta); err != nil {
		t.Fatal(err)
	}

	sampleSchema := bigquery.Schema{
		{Name: "key", Type: bigquery.StringFieldType},
		{Name: "product", Type: bigquery.StringFieldType},
		{Name: "version", Type: bigquery.StringFieldType},
		{Name: "platform", Type: bigquery.StringFieldType},
		{Name: "event", Type: bigquery.StringFieldType},
		{Name: "installid", Type: bigquery.StringFieldType},
		{Name: "created", Type: bigquery.StringFieldType},
	}

	metaData := &bigquery.TableMetadata{
		Schema:         sampleSchema,
		ExpirationTime: time.Now().Add(time.Duration(1*60) * time.Second), // Table will be automatically deleted in 1 day.
	}
	tableRef := client.Dataset("dataset").Table("table")

	if err := tableRef.Create(ctx, metaData); err != nil {
		t.Fatal(err)
	}

	inserter := client.Dataset("dataset").Table("table").Inserter()

	items := []*MockUsageEvent{
		{Key: "1bjCljWkq6tinyAMuu0tEAhB80", Product: "Phrased Flintstones0", Version: "Phrased Flintstones0", Platform: "Phrased Flintstones0", Event: "license-request", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB81", Product: "Phrased Flintstones1", Version: "Phrased Flintstones1", Platform: "Phrased Flintstones1", Event: "camera", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB82", Product: "Phrased Flintstones2", Version: "Phrased Flintstones2", Platform: "Phrased Flintstones2", Event: "activation", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB83", Product: "Phrased Flintstones3", Version: "Phrased Flintstones3", Platform: "Phrased Flintstones3", Event: "textsearch", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB84", Product: "Phrased Flintstones4", Version: "Phrased Flintstones4", Platform: "Phrased Flintstones4", Event: "barcode", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB85", Product: "Phrased Flintstones5", Version: "Phrased Flintstones5", Platform: "Phrased Flintstones5", Event: "ocr", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB86", Product: "Phrased Flintstones6", Version: "Phrased Flintstones6", Platform: "Phrased Flintstones6", Event: "fooddetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB87", Product: "Phrased Flintstones7", Version: "Phrased Flintstones7", Platform: "Phrased Flintstones7", Event: "classifications", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB88", Product: "Phrased Flintstones8", Version: "Phrased Flintstones8", Platform: "Phrased Flintstones8", Event: "customdetection", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones9", Platform: "Phrased Flintstones9", Event: "detectinimage", InstallId: "1", Created: "2022-10-11T17:31:39"},
		{Key: "1bjCljWkq6tinyAMuu0tEAhB89", Product: "Phrased Flintstones9", Version: "Phrased Flintstones10", Platform: "Phrased Flintstones10", Event: "packagedfood", InstallId: "1", Created: "2022-10-11T17:31:39"},
	}

	if err := inserter.Put(ctx, items); err != nil {
		t.Fatal(err)
	}

	query := `
	SELECT yearMonth, count, key
			FROM (
					SELECT key, FORMAT_DATE('%Y-%m', PARSE_DATETIME('%Y-%m-%d %H:%M:%S', created)) AS yearMonth, count(distinct installid) as count
					FROM test.dataset.table
					WHERE DATE(created) BETWEEN DATE '2022-09-14' AND DATE_ADD(DATE '2022-10-14', INTERVAL 1 DAY)
					GROUP BY key, yearMonth
					ORDER BY yearMonth
				) AS counts
		 WHERE key IN ("1bjCljWkq6tinyAMuu0tEAhB80","1bjCljWkq6tinyAMuu0tEAhB82","1bjCljWkq6tinyAMuu0tEAhB86") ORDER BY key
`

	var rows *bigquery.RowIterator
	rows, err = client.Query(query).Read(ctx)
	if err != nil {
		t.Fatal(err)
	}
	//var rows *bigquery.RowIterator

	//rows, err := bigQueryClient.Query(query).Read(ctx)

	if err != nil {
		return
	}
	fmt.Println("rows", rows.TotalRows)

	usesss, err := scanTestWithoutSize(rows)

	fmt.Println("usesss", usesss)

	return
}

func scanTestWithoutSize(rows *bigquery.RowIterator) ([]*uses, error) {
	fmt.Println("rows", rows)
	var usesList []*uses

	for {
		uses := uses{}

		err := rows.Next(&uses)
		if err == iterator.Done {
			break
		}
		if err != nil {
			fmt.Println("err", err)
			return nil, fmt.Errorf("error reading report Data. Err: %v", err)
		}
		usesList = append(usesList, &uses)
	}
	return usesList, nil
}

The your pasted code is invalid at this time. Support will be finished. #59 (comment)
@goccy
I am setting up the code that's why it will take some time to format the code.

Thank you so much @goccy
it's working !!!!!! :)

authors: Vikas-MI goccy jhowliu

repo: goccy/bigquery-emulator


text:
The attribute origin is not allowed to appear in element fetchartifact on versions under 18.2

What
The default value for the origin attribute has been set to None.
Also, the xsd schema has been updated removing the requirement.
And condiction was added in order to verify the nullable value.
Why
Versions lower than 1.8.2 don't allow the origin attribute within fetchArtifact element. The changes made on  https://github.com/gocd-contrib/gomatic/commit/5274606037d3dff91c16952548a20351c9928b37 are breaking Gomatic due to Attribute ‘origin’ is not allowed to appear in element ‘fetchartifact’.
So, the changes are just to guarantee Gomatic to still work on GoCD as 1.8.2.

Somehow our integration tests didn't catch this, it would be nice to understand why

Released as 0.6.3

source: gharchive/pull-request

authors: biharck dudadornelles

repo: gocd-contrib/gomatic

license: MIT

license_type: permissive

license_source: github-api


text:
Elastic Profile settings do not render correctly on GoCD 23.2.0+

The profile settings are cropped off after the "Bind Mount" section on GoCD 23.2.0 and it's not possible to view or enter EC2 instance configuration.
Additionally, the style is not rendered correctly so it looks ugly.

This was fixed in https://github.com/gocd/gocd-ecs-elastic-agent/commit/5c999614088d22f673b0bae34cf66d0aa09950b7
This is due to an upgrade to JQuery 3.5+ within GoCD 23.2.0 which no longer "fixes" tags to be HTML compliant which are valid in XHTML, but not valid HTML, due to security problems with this approach.
Versions of the plugin prior to 7.3.0-416 use an incorrect self-closing <textarea/> element which breaks the HTML causing the view to be cropped off.
Fixed in https://github.com/gocd/gocd-ecs-elastic-agent/commit/5c999614088d22f673b0bae34cf66d0aa09950b7 and https://github.com/gocd/gocd-ecs-elastic-agent/releases/tag/v7.3.0-416

source: gharchive/issue

repo: gocd/gocd-ecs-elastic-agent


text:
Image Pull Secret and Proxy Support

In our company network, we cound only access internet via a internal proxy, and all certificates are self signed. Need to change the go server & agent images to add custom ca and add proxy environments. Besides, our self hosted docker registry require authentication. and I need to manually update the deployment to specified pulling secret.
Request for the following capabilities for helm chart:

expose pulling secret options.
able to set proxy(and no proxy configs) via helm values
able to add custom ca certs

A PR for image pull secret, or similar chart to model off would be welcome.
For which functions do you expect the proxy and custom CA cert to be used for? It's already possible to set arbitrary env vars with server.env.extraEnvVars if it's just for pre-startup plugin installs.
If you need regular server operations (polling materials or repositories) to go through the proxy, you might not have much luck based on https://github.com/gocd/gocd/issues/8699 - and I suspect it would be misleading to add special config to the Helm chart for functionality that the server does not really support. Agents support being proxied via https://docs.gocd.org/current/installation/configure-agent-proxy.html which should be able to be configured with agent.env.goAgentJvmOpts.
If you already have a solution/workaround/hack that works for you, please share it so we can see if it's appropriate to make more general.

Our proxy and internal website uses a self signed certificate which I need to ignore the ssl verification or add our root CA to trusted store.
For the custom CA issue, I created a docker image based on GoCD's official image and manually appended to /etc/ssl/certs/ca-certificates.crt
And for the pull secret, I patches the gocd-server deployment after installs/upgrads by helm using kubectl -ngocd patch deploy gocd-agent -p '{"spec":{"imagePullSecrets":[{"name":"regcred"}]}}'. the secret regcred is created by myself and contains credential against the private registry.

For the custom CA issue, I created a docker image based on GoCD's official image and manually appended to /etc/ssl/certs/ca-certificates.crt. And specified the gocd.server.image to the new one. But this is definitely not a general solution. May be the helm chart could add some arguments which allows to append custom CA contents(maybe based64 encoded) to /etc/ssl/certs/ca-certificates.crt before server starts.

OK, so you only care that GoCD can start up and bootstrap plugins? This bit generally does require internet access if you want it to auto-install plugins from GitHub. Are you aware that this behaviour can be disabled via server.shouldPreconfigure=false
And to confirm, you don't need the GoCD Server itself to use your custom CA cert? (because I don't believe that will work with /etc/ssl/certs/ca-certificates.crt alone)
If you do want the downloaded plugins, you already have these options that I can see

you can already mount your own ca-certificates.crt from a volume/configmap using persistence.extraVolumeMounts without building a new image
or if you would prefer to build a Docker image, you can pre-include the relevant plugins during docker build so there is no runtime dependency to talk out to the internet/GitHub and disable download with server.shouldPreconfigure=false
or alternatively to put the plugins on some storage and mount a volume that tells GoCD how to find them

I'd like to see support for helm static agents as well using :
spec:
  imagePullSecrets:
  - name: github-container-registry-key

We can do this with the elastic agents, and it works well, I'd like to be able to edit my values file to achieve the same on the static agent.

Here is a good example I think: https://github.com/Azure-Samples/helm-charts/blob/master/chart-source/image-pull-secret/templates/acs-helloworld.yaml
I've never done anything with helm templates, but I'll see if I can figure it out and submit a PR.

For the record, I don't have any particular concern with imagePullSecrets, however I am much more suspicious about attempts to deal with proxies.
There are other ways to approach thiswhich  the chart already supports (above, even if they could be better documented) and other attempts in the chart seem likely to give a misleading impression as to whether it is configuring overall application proxy support (which is a somewhat different problem).

For the custom CA issue, I created a docker image based on GoCD's official image and manually appended to /etc/ssl/certs/ca-certificates.crt. And specified the gocd.server.image to the new one. But this is definitely not a general solution. May be the helm chart could add some arguments which allows to append custom CA contents(maybe based64 encoded) to /etc/ssl/certs/ca-certificates.crt before server starts.

OK, so you only care that GoCD can start up and bootstrap plugins? This bit generally does require internet access if you want it to auto-install plugins from GitHub. Are you aware that this behaviour can be disabled via server.shouldPreconfigure=false
And to confirm, you don't need the GoCD Server itself to use your custom CA cert? (because I don't believe that will work with /etc/ssl/certs/ca-certificates.crt alone)
If you do want the downloaded plugins, you already have these options that I can see

you can already mount your own ca-certificates.crt from a volume/configmap using persistence.extraVolumeMounts without building a new image
or if you would prefer to build a Docker image, you can pre-include the relevant plugins during docker build so there is no runtime dependency to talk out to the internet/GitHub and disable download with server.shouldPreconfigure=false
or alternatively to put the plugins on some storage and mount a volume that tells GoCD how to find them

The certificate is not only for GoCD to bootstrap and download plugins, after GoCD started, the certifacte is also required to pull the self-hosted git server which using the self signed certs.

I'd like to see support for helm static agents as well using :
spec:
  imagePullSecrets:
  - name: github-container-registry-key

We can do this with the elastic agents, and it works well, I'd like to be able to edit my values file to achieve the same on the static agent.

For elastic agent it's easy to configure pull secrets, but since I need to create a custom GoCD server image, I wish I cound provide the pull secret in the helm arguments. Besides, since GoCD helm chat provides the capability to custom the image repository, I think it should provide the way to configure pull secret as well(Offical Docker hub now have quotas and ratelimit for pulling the image, even if I'm not creating the custom GoCD server images, I need to mirror the server image from office Docker hub to my private registry which enables authentication)

The certificate is not only for GoCD to bootstrap and download plugins, after GoCD started, the certifacte is also required to pull the self-hosted git server which using the self signed certs.

@coney This only works by accident, because you happen  to use git, and GoCD executes git commands by forking the native git binary, which in turn happens to use libcurl which happens to also default to loading certs from /etc/ssl/certs/ca-certificates.crt. Any change to these dependencies would break a special solution in the Helm chart that alters /etc/ssl/certs/ca-certificates.crt, and thus it is not appropriate for the chart to have special logic that assumes the behaviour of these lower layers.
It will also likely not work if proxy is required for other SCMs, or for some artifact repository which uses a native Java integration via a plugin, or perhaps for an elastic agent plugin that may also need to talk through a proxy.

you can already mount your own ca-certificates.crt from a volume/configmap using persistence.extraVolumeMounts without building a new image

As in the above suggestion, if your hack/custom /etc/ssl/certs/ca-certificates.crt already works for you, the helm Chart already supports mounting anything you like there, so as far as I can tell there is no requirement for a change to the chart.
To add fuller example, create or modify ca-certificates however you feel like

kubectl create configmap gocd-server-ca-certs --from-file=ca-certificates.crt
Modify values and helm update

server:
  env:
    extraEnvVars:
    - name: https_proxy
      value: http://proxy.company.com
    - name: no_proxy
      value: internal-thing.company.com
  persistence:
    extraVolumes:
    - name: gocd-server-ca-certs
      configMap:
        name: gocd-server-ca-certs
        defaultMode: 0755
    extraVolumeMounts:
    - name: gocd-server-ca-certs
      mountPath: /etc/ssl/certs/ca-certificates.crt
      subPath: ca-certificates.crt
      readOnly: true

The same thing can be done for static agents provided by the chart, or in kubernetes elastic agent configuration.
We should not add configuration to the Helm chart which is misleading as to the capability it provides across the many things GoCD can do, and your specific use case of customising the ca-certs seems already supported. Please let me know if you have tried the above.
Supporting imagePullSecrets makes sense, will merge something shortly.

The support for imagePullSecrets will be available in 1.40.1 shortly. Thanks @brettcurtis for getting a start on this in https://github.com/gocd/helm-chart/pull/35
I'm going to close this issue now, as I feel the chart already has adequate support for customising ca-certificates.crt and proxy env vars for use by curl/libcurl as noted above, without needing to build a custom Docker image. If this doesn't work for you @coney please provide a bit more information and we can open a more specific issue.

authors: brettcurtis chadlwilson coney

repo: gocd/helm-chart


text:
Improve cluster profile setup docs

Adding some extra helpful details:

A more accurate set of permissions that the GoCD server needs, and whether they should be at the cluster scope or namespace scope. I couldn't find any code in the plugin that lists or gets namespaces, or creates a watch on events, so removed those permissions from the doc. I've also tested the set of permissions documented here on my GoCD server and the plugin is working (running pipelines, and poking around the cluster status report page).

Small clarifications around what defaults are used for optional parameters

A few small typo fixes

This should resolve https://github.com/gocd/kubernetes-elastic-agents/issues/319 by documenting permissions needed for a non-default namespace

Thanks for this, will try and get a chance to look through soon.

Hooray, thank you @chadlwilson!

authors: brandonvin chadlwilson

repo: gocd/kubernetes-elastic-agents


text:
Periodic actor creation failure

The stress testing in the thespian/test/test_createActor.py reveals an occasional problem in creating Actors.  The frequency of the issue appears to be very low in local testing (approx 1 failure in each 10 runs, where each run creates ~60+ actors), independent of the system base (manifests for multiprocQueueBase, multiprocUDPBase, and multiprocTCPBase), but occurs sporadically.  Further investigation is required to identify and resolve this issue.

Issue appears to be resolved as of the 3.8.0 release by various fixes in the interim.

repo: godaddy/Thespian

license: mit

license_source: bigquery


text:
HingeJoint - Lower angular limit not taken in account

Godot 4.0.2
Windows 10
Intel(R) Core(TM) i7-7700K CPU
Nvidia 2080 Super
HI, I'm not 100% this is a bug or a misconfiguration from me.
The behaviour of hinge joints is quite different between the two physics engines, this is expected i guess.
The problem is that the lower angular limit does not seem to apply with the jolt engine.
Please check the MRP
test-hinge-godot-jolt.zip
Switch between the two engines

Thanks ! I didn't read the warning thouroughly and i thought it was the same as the one for the upper limit

repo: godot-jolt/godot-jolt


text:
No way to have convenient initial values when creating nodes

Following this revert #12308, I'm asking for the possibility to set different default values on some nodes for convenience, when they are created in the editor.
For example, I made a PR earlier, where DirectionalLights created in the editor would spawn with a natural sun-like angle, instead of the default horizontal axis: https://github.com/godotengine/godot/pull/11587
The problem is, for some reason, even though I do this in the constructor, it overwrites the transform loaded from the scene.
My theory is that Godot does very custom initialization of class fields by calling constructors manually and setting properties in between, while I expected this to happen AFTER all constructors were called.
This makes my proposal impossible, hence why it got reverted...
So... is there a better way to do it? Because I don't know how :/
cc @reduz

After doing some digging, I can confirm that Godot is not doing custom construction. It all comes down to:
https://github.com/godotengine/godot/blob/78fbf507f034deac8ef5ac448baf0778455558c6/core/os/memory.h#L97
which allocates the memory, and then lets C++ handle the construction. The default initializers are automatically called, oldest first (Object::Object(), Node::Node(), etc...) ending with the ctor of the class being constructed (e.g. DirectionalLight::DirectionalLight()).
For scene and resource loading, the construction happens here:
https://github.com/godotengine/godot/blob/78fbf507f034deac8ef5ac448baf0778455558c6/scene/resources/packed_scene.cpp#L156-L178
which checks the class exists, instances a default otherwise (based on the type of the node's parent), and casts the instanced Object* to Node*.
Then, later on, starting at line 185, the actual properties are set. If things aren't working, it's in this section that the culprit likely lies.

Also, I figured out what the problem you were encountering was - at the time, the transform was built using the data.rotation variable, and the scene was only saving the data.transform property.
https://github.com/godotengine/godot/blob/14b1741cbf998f6d950a006681b15803362442d7/scene/3d/spatial.cpp#L86-L92
(Excerpt from the provided example project:)
[gd_scene format=2]

[node name="DirectionalLight" type="DirectionalLight"]

transform = Transform( 1, 0, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0 )

When the node was initialized, data.rotation was set by your addition of set_rotation_in_degrees, and then never overridden by loading the scene. The transform was marked dirty (either by being added to the scene for the first time, or by set_rotation_in_degrees) and the transform was then recalculated, resetting the rotation to the initializer's value.
@Zylann, @akien-mga, I believe this resolves the issue, and it can be closed.

How can we have initial values when instancing a node in editor then?

Like so:
DirectionalLight::DirectionalLight(){
//Depending on what you are doing, you may not need the TOOLS_ENABLED check
#ifdef TOOLS_ENABLED
set_transform(new_transform);
#endif
}

You just have to set your initial values in a way that doesn't cause loaded values to be overriden. This may warrant a new issue regarding how Spatial transforms are loaded from disk, but setting initial values works just fine.

Fair warning, I came about this knowledge purely through reading the source, and it may not be 100% accurate. If you can still reproduce the bug on current source, I'll take another crack at it.
Here's how it went:

Construct the node. Your constructor sets data.rotation to the initial rotation (which marks DIRTY_LOCAL.)
Load the node's properties from the PackedScene. This sets data.local_transform (and marks DIRTY_VECTORS.)
Add the node to the scene: calls _notification(NOTIFICATION_ENTER_TREE). If running standalone, skip to 5, as this calls get_transform().
Something somewhere (probably editor code) calls get_transform() before get_rotation() or get_scale() (the functions that update the vectors as a side-effect) have been called. None of the flags have been unset.
Because DIRTY_LOCAL hasn't been unset, get_transform() calls _update_local_transform() as linked above, which updates the transform using the value of data.rotation, which hasn't been changed to reflect the loaded transform. This clears DIRTY_LOCAL.
Later, get_rotation() or get_scale() are called. Because DIRTY_VECTORS is still set, it updates these values from the (now overridden) transform.
Voila, your light now always loads to be pointing in the direction set in the constructor. Aren't race conditions fun? :/

The workaround is simple - use set_transform instead of set_rotation, or have the loading code update the vectors right away when loading the scene.

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.
The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.
If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

authors: Calinou Web-eWorks Zylann

repo: godotengine/godot


text:
ON/Off option is reverse in activating ragdoll

Godot version:

9b1fdad
OS/device including version:

linux mint
Issue description:

I create the physical skeleton by the button and I use physical_bones_simulation(true) to activate it. The result is fine if I don't check simulate physics option of the physical bones in the editor. If I check the bone while using physical_bones_simulation(true), it stops the simulation of that bone. It is off instead of on.
Another problem, I don't know whether it is a bug or not. is it true that I must call physical_bones_simulation(true) to activate the simulation and check/uncheck desire bone with simulation? If I don't call physical_bones_simulation(true) and check the simulate physics of the physical bones option in the editor, nothing happens.
Steps to reproduce:
create the physical skeleton
call  physical_bones_simulation(true)
check the simulate physics option of the physical bones in the editor
Minimal reproduction project:

Thanks you for your comment, I've improved the API in order to make easy the activation and deactivation of full body or partial.
Also I've removed the possibility to check simulation on physical bone on the editor in order to avoid misunderstanding.
Thanks you for your contribution!
Check this #18764

authors: AndreaCatania ZX-WT


text:
GDScript leaking potentially when cannot load due to cyclic dependency

Godot version:
b2569d5fa8e45173bbd8c03d9887e7635c7986b0
OS/device including version:
Linux Ubuntu 5.3.1-050301-generic
Issue description:
Godot is leaking memory (failure to cleanup).
It possibly happen when GDScript fails to load a class due to cyclic dependency or parse error.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Game.gd:82.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Networking/Network.gd:235.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Game.gd:82.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
ERROR: start: Timer was not added to the SceneTree!
   At: scene/main/timer.cpp:111.
ERROR: start: Timer was not added to the SceneTree!
   At: scene/main/timer.cpp:111.
SCRIPT ERROR: GDScript::reload: Parse Error: The class "Controls" couldn't be fully loaded (script error or cyclic dependency).
   At: res://Scripts/Networking/Network.gd:236.
ERROR: reload: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:576.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: ./core/self_list.h:111.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: ./core/self_list.h:111.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:2069.
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:443.

Steps to reproduce:

Clone KoBeWi's https://github.com/KoBeWi/The-Soulhunter
Run the game at least once (there will be errors)
Exit

Minimal reproduction project:
https://github.com/KoBeWi/The-Soulhunter

Update: It will leak simply by opening and closing the project...Will try to investigate...

Can you still reproduce this bug in Godot 3.2.2 or any later release?
This may also be something that isn't being fixed until Godot 4.0 releases with the new improvements to GDScript. I remember vnen talking about improvements to cyclic dependencies.

Duplicate of #16959.

authors: akien-mga clayjohn hbina


text:
Brackets and quotes should wrap around selected word in the script editor

This is an idea to improve the script editor.
If we select a word on the editor and type any of these symbols
' " ( { [
the selected text is replaced by these symbols.
It will be good if the behaviour is like those in sublime or atom editor. The word will be wrapped around with the symbol and it's closing symbol.

#2982

This one can be closed, as it works when auto_brace_completion is enabled. Similar to that in sublime text.


text:
Dragging a Script from the Script Dock onto an export Script variable doesn't work

Godot version:
3.2.2 beta 1
OS/device including version:
Windows 10
Issue description:
Dragging a script from the script dock onto an exported Script variable doesn't work.
(However, dragging a script from the FileSystem dock works.)

Steps to reproduce:
Create an export script variable.
Try to drag a script from the script dock and you'll get the "red circle backslash" symbol.

(Dragging from the FileSystem dock works as expected)

Minimal reproduction project:
ScriptDragDropExample - 2.zip

The above PR should fix this!


text:
iOS Safari refuse IndexedDB access in iframes

Godot version:
3.2
OS/device including version:
iOS 13
Issue description:
You cannot load a game from another domain through an iframe. I believe this is because Godot initializes IndexedDB (even when not used), and Safari does not allow indexedDB in an iframe.
Minimal reproduction project:
Create html file and try opening this project from your own domain - happens with any export though, so very easy to reproduce:

I would suggest switching to localStorage or an option in Project Settings to not initialize IndexedDB.

Defold users are having the same problem btw:
https://forum.defold.com/t/html5-save-user-progress-inside-an-iframe/64073

Related to #34102.

@Faless Would your recent fixes in #39538 solve that?

Yes, this should be fixed in #39538, but I can't test iOS.

@ChronoDK This should be testable in 3.2.2 RC 2 in a day or two (or any later build).

Very cool - I'll test as soon as possible!

I can confirm this is now fixed in 3.2.2 RC2!

authors: Calinou ChronoDK Faless akien-mga


text:
Add scroll in Web editor Loader page

Godot version:
3.2.4 beta 4(Web Editor)
OS/device including version:

Ubuntu 20.10, Mozilla Firefox
Screen 1366x768
Issue description:
Couldn't scroll in Loader page in Web Editor
Steps to reproduce:
Open Web Editor and try scroll

I'm working on the HTML5 editor page and downsized the logo so that scrolling shouldn't be necessary anymore, even on 1366×768 or mobile displays.


text:
Setting font on labels will crush the app on Android

Operating system or device - Godot version:
Nexus 7, Android 6.0.1, Godot compiled @commit b777b3.
Issue description (what happened, and what was expected):
If I specify a font in a GUI node, e.g. Label, and deploy the app to Android, the app won't start, and stays in a loop showing Godot splash screen, crashing, and again.
This happens to both bitmap or dynamic fonts on this build. If a bitmap font is used, the same project works just fine running on Godot 2.0.3.

Did you compile templates for b777b32, or are you using templates for 2.0.3? If so, they are not compatible, you should always use templates that match your editor version.

Same error as #4606, so likely same resolution :)

Thanks @akien-mga, tried compiling and the new templates seemed to work fine.
The template compiling process needs quite a lot manual intervention, and is not as convenient as Godot compiling.

Yeah building templates is a lot of work. We'll soon make an official 2.1 alpha release with editor + templates, so that should help for people who want to play with the development branch :)

authors: akien-mga azurvii


text:
code not working

Godot version
v3.3.3.stable.mono.offical [b973f997f]
System information
GLES3, MacOS High Sierra, Intel HD graphics 6000
Issue description
func btn_pressed():
get_tree().change_scene("res://path/to/shawty.tscn);
not working
Errors:
/Users/academystudent/godot/main scene/scripts2/changescene.cs(18,20): error CS1002: ; expected [/Users/academystudent/godot/rpg.csproj]
/Users/academystudent/godot/main scene/scripts2/changescene.cs(18,20): error CS1513: } expected [/Users/academystudent/godot/rpg.csproj]
Steps to reproduce
func btn_pressed():
get_tree().change_scene("res://path/to/shawty.tscn);
Minimal reproduction project
No response

You have a typo in your code sample — you didn't close the string with a second double-quote.
Please, don't create issues if you have problems with your code. This is not a support forum, this is a bug tracker. Use our community platforms to ask for help with fixing up your projects and learning Godot:
https://godotengine.org/community


text:
Changes to theme constants after saving/running the project don't get applied correctly

Godot version
3.4
System information
Windows 10
Issue description
Setting a constant in a theme, then saving/running the project leads to later changes to the constant being visible in the editor, but not in-game, including when re-running the project.
Restarting Godot leads to the constant being reset to the previous value.
Steps to reproduce
Add a node with some constant overridable by a theme (e.g. VBoxContainer with two Buttons as children)
Create a theme and add it to the node/a parent
Add the associated node type item to the theme, and set some value for the desired constant (e.g. seperation for VBoxContainer)
Save/run the project
Modify the constant's value, and run the project
Minimal reproduction project
N/A

cc @pycbouh

Can you provide an MRP?

added MRP and steps to initial comment

Thanks! There's some weird de-synching going on. First time I opened the project, it didn't work just like you'd described. Then after poking at it for a few minutes, it started to update correctly all the time. Then it started to update only when I pressed "Save" directly in the Theme editor. Then I dropped the project and replaced it all with the original files, and it now updates correctly in game, but the inspector doesn't get updated.
I'll have to look into it more later. But try pressing "Save" in the Theme editor, I guess?

Can confirm that saving it inside the theme editor seems to work consistently.
I also found that deleting and re-adding the constant makes it update correctly for me.

authors: Calinou SireMM pycbouh


text:
View-dependant SSAO artifact in center of screen when half-size is enabled

Godot version
4.0 Alpha 5
System information
Kubuntu 20.04, Nvidia GTX 1060, Driver 510, Vulkan
Issue description
A dark vertical line appears in SSAO in the center of the screen when half-size is enabled in the project settings. the line appears to be view-dependant and can only be seen from certain angles.
Half size:

Full res:

Steps to reproduce
Create a new scene, add some objects, enable AO look at the scene from different angles. I think it's pretty obvious in the regular view, but the SSAO debug view makes it even more apparent.
Minimal reproduction project
SSAO artifact.zip

This is related https://github.com/godotengine/godot/issues/51564#issuecomment-897700747

authors: NineAlexT mrjustaguy


text:
Pausing causes various errors with Area2Ds

Godot version
4.0.dev (a534346)
System information
Windows 10
Issue description
If a body is within an Area2D's CollisionShape2D when the scene is paused and resumed two things happen:
If the body is higher in hierarchy (behind the Area2D), all signals are disconnected from the Area2D.
https://user-images.githubusercontent.com/21325943/170354862-e9274c51-848d-47a2-9b4c-9cc1f4e47b36.mp4
If the body is lower in the hierarchy (in front of the Area2D), errors are written to the console.
https://user-images.githubusercontent.com/21325943/170354890-7fd076fc-691e-4fa2-a2ea-7f3badfa97f0.mp4
Steps to reproduce

Create CharacterBody2D with collision.
Create Area2D with collision.
Connect BodyEntered signal for Area2D.
Pause and Resume game while body is inside Area2D.

Minimal reproduction project
CollisionBugGD.zip
(converted to GDScript project)

Still present in f38ea254f3

More oddities found with the new pause system while testing:
Currently, some nodes/controls (ex: Button) will connect and fire signals (ex: on_mouse_entered) whether the scene tree is paused or node is set to PROCESS_MODE_DISABLED.
Other nodes, will not connect signals if the scene tree is paused in the same cycle, even if paused after the connection happens.
This can be unexpected and possibly impossible to work around, especially in common scenarios like menu stacks where only the highest menu should have processing/signals enabled.
These may be unrelated and worth separate tickets, but I'm unfamiliar with the internals, so I can't say one way or another.

Still present in 8a98110e
Updated MRP:
PauseBug.zip

I spent a while looking into this one, posting my findings here cause I am not sure what to do to fix:
1. Discrepancy in behaviour depending on who is on top
Whoever is on top of the tree is the one "monitoring" for the other, then, when enabling/disabling the process mode code will follow different paths on _apply_disabled() and _apply_enabled()  resulting in different behaviours.
2. Signal's disconnection
There isn't in fact a signal disconnection, but by the way the area2d function monitoring bodies coming in and out, when that is on top of the hierarchy (thus monitoring) and you set PROCESS_MODE_DISABLED it doesn't get a callback saying the object is out. This makes it so this counter doesn't get decremented, and when the object actually leaves the area this is never called.
3. Why is the callback not called when Area2D is the one monitoring but not when it's CharacterBody2D
Back to 1., when _apply_disabled() goes the area route, this function is called, particularly it calls for get_space()->area_remove_from_monitor_query_list(&monitor_query_list); in essence removing itself from the monitor_query_list and making it so the callback set for the leaving of the object to not be called on call_queries().
4. Error log when CharacterBody2D is on top
I haven't really looked much to it, but this function has some comments on the counter that feels weird to me. https://github.com/godotengine/godot/blob/master/scene/2d/physics_body_2d.cpp#L366

Possible fix
On theory this would handle the worst reported issue, making sure all callbacks are handled before set_space does it's thing.
void GodotArea2D::set_space(GodotSpace2D *p_space) {
	call_queries();  // make sure to handle any callbacks before clearing the space
	if (get_space()) {
		if (monitor_query_list.in_list()) {
			get_space()->area_remove_from_monitor_query_list(&monitor_query_list);
		}
		if (moved_list.in_list()) {
			get_space()->area_remove_from_moved_list(&moved_list);
		}
	}

	monitored_bodies.clear();
	monitored_areas.clear();

	_set_space(p_space);
}

I am not opening a PR because this looks completely wrong, imo the way the process enable/disable is currently done is quite error prone and invites these quirks for specific cases.

The problem is that the Area2D is getting a new _body_inout event on unpause if the object is still in the Area2D. Because the body_map on the Area2D already has that object in it, it iterates the rc element. The iteration is done in line 195:
https://github.com/godotengine/godot/blob/c151d3231f8e5d207f64055c60c70967dd5351b5/scene/2d/area_2d.cpp#L195
What I'm confused about now is what situation would require us to count the same body multiple times on the same Area2D. A quick-and-dirty solution is to just check if the body is already in the body_map, but that completely eliminates the use of the rc iteration. I made this change locally and tested it and it resolves the issue. We could also just explicitly set the rc to 1 one on line 185 and eliminate line 195:
https://github.com/godotengine/godot/blob/c151d3231f8e5d207f64055c60c70967dd5351b5/scene/2d/area_2d.cpp#L185
I think there's two areas to further investigate:

Why does unpausing send a new inout event?
Is the rc element of BodyState used for reference counting? If that's the case, then in what instance would rc need to be anything other than a boolean?

It looks like this system is supposed to implement reference counting for a scenario where multiple object are referencing the same body_map object, but the implementation of Area2D as it currently exists creates a body_map for each instance of Area2D.
I would need information from someone more knowledgeable about the physics engine as a whole, but it appears the only references to value.rc are within this specific function call.
This is also an issue in Area3D

Same error as in https://github.com/godotengine/godot/issues/70848
However, trigger conditions slightly differed. I the bug above, I could only trigger in timeout callback (re-enabling at any time), or during process/physics process by re-enable node immediately in same frame as disabling.
It seems than manual toggle also triggers the bug in this demo, but I'm not sure of the exact conditions.

@hcoura Thanks, I see now that your point "2. Signal's disconnection" may be the cause of https://github.com/godotengine/godot/issues/76219

I think I found what causes the bug, it comes from monitor_query_list in GodotSpace2D being added to after an unpause which will erroneously trigger a call to  Area2D::_body_inout when  GodotPhysicsServer2D::flush_queries is called leading to GodotArea2D::call_queries which leads to Area2D::_body_inout finally leading to the reference count getting incremented incorrectly.
I'll try to copy the call stack which causes it:
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/main/main.cpp#L3488-L3490
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_server_2d_wrap_mt.cpp#L73-L75
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_physics_server_2d.cpp#L1282-L1284
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_step_2d.cpp#L255-L257
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_step_2d.cpp#L84-L86
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_area_pair_2d.cpp#L72-L74
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_area_2d.h#L162-L164
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_area_2d.cpp#L199-L201
->
https://github.com/godotengine/godot/blob/787259441abb7aa92a382ccf48591a70136f25f0/servers/physics_2d/godot_space_2d.cpp#L1099-L1101
I am not sure what the solution would be, so I am not opening a PR yet

It happens when disabled because the monitor_query_list is emptied of the area when both paused and disabled (There is a call to area_add_to_monitor_query_list followed by a call to area_remove_from_monitor_query_list). I am still not sure how it all functions...

It takes two to make a collision. If either is disabled, collision will no longer exist. It should be noted that unpair will cause the area to eventually be added to monitor_query_list, although it may have previously tried to remove from monitor_query_list.
https://github.com/godotengine/godot/blob/ba54c34551d1bda5139515d74e7d614ccbc43cea/servers/physics_2d/godot_area_2d.cpp#L66-L68
If it is disabled in the order of A-B (Area-Body), the area will eventually be added to the monitor_query_list; if it is disabled in the order of B-A (Body-Area), the area will not be added to the monitor_query_list in the end.
https://github.com/godotengine/godot/blob/ba54c34551d1bda5139515d74e7d614ccbc43cea/servers/physics_2d/godot_space_2d.cpp#L1126-L1130
That is, in the above code, monitor_query_list.first() is different in the two cases. Area2D::_body_inout() will be called when A-B, but will not be called when B-A.
ERROR: Condition "p_elem->_root" is true.
   at: add (./core/templates/self_list.h:46)

For the error message during resumed. The body is paired with the area in place and becomes active. This causes the same body to be added to the active_list twice.
https://github.com/godotengine/godot/blob/4df80b0e629e25653a706f6721c13a1f9d1da368/servers/physics_2d/godot_area_pair_2d.cpp#L99-L101
https://github.com/godotengine/godot/blob/4df80b0e629e25653a706f6721c13a1f9d1da368/servers/physics_2d/godot_body_2d.cpp#L410-L412

Tested the new PR. While it doesn't fix the problem enough to close out this ticket, it's still a big step forward. However, I am curious if it is intentional that pausing/unpausing a scene causes enter/exit signals to retrigger in Area*D's. That is the current behavior, so unrelated to the referenced PR, but it's definitely problematic. My wonder is if it's more or less problematic if it does than if it doesn't.

I would expect signals to not be retriggered after unpausing. I'm imagine pausing as some kind of hole in Node's lifetime. It should not affect its behaviour. After unpausing it should stay at the exact same state it was when it was paused.

Hey, is there any workaround for this issue right now?

authors: MetalChair MrWolfyer Rindbee aniezurawski golfinq hcoura hsandt markdibarry


text:
Visual Shader Editor UniformRef Node has a "Redefinition of 'uniform node here' error

Godot version
v3.4.stable.mono.official[206ba70f4]
System information
Windows 10, Amd Rx 570, I3 cpu, GLES3
Issue description
When Using the UnformRef node in godot for some reason you get a Redefinition error
I checked over the code and yes for some reason the uniform is redefined in the code which is odd because I just expect it to reference the uniform with name only.

Steps to reproduce
-Make a new visual editor resource
-Add in a uniform node and name it
-Add a UniformRef node and in the drop down select the uniform node
Minimal reproduction project
VS problem.zip

Yeah, seems like it broken for 3.x branch for some reason, in 4.0 it works correctly.

Ok, glad to know this is working on godot 4.0
thanks

Fixed by #63105.

authors: Chaosus NothingAnimated akien-mga


text:
Godot allowing adding files and folders with special characters (etc !@#$%)

Godot version
v3.4.4 stable official
System information
Windows 10, Git and Github Desktop
Issue description
When creating a new file/scenes/scripts, Godot allows special characters which let your VCS to broke (you can't commit)
I expect it not allowing special characters in file name
Steps to reproduce

Create a new godot project (or open an existed one)
Click "New Scenes" in the File System
Enter some special characters
Save It

Minimal reproduction project
No response

The editor should already prevent you from creating files with characters not allowed on Windows, with a few exceptions.
Some of the characters you mentioned are legal to have in version control, but it's possible that the app you're using doesn't handle files with those character names well. This isn't something we can fix on our end.

I've change the tile because I realized windows allow !@#$%

authors: Calinou MeBadDev


text:
Gradient sliders bug out when changing colors

Godot version
4.0 Beta 2
System information
Windows 11
Issue description
When trying to change color of gradients, the slider often keeps moving with the mouse even when the color picker is active, and keep moving even when mouse isn't held after the color picker has been closed.
Steps to reproduce
Make a Gradient, try to pick colors, move mouse over the slider while the color picker is active, or after you've closed it, notice the bar is following the mouse, but you aren't holding the mouse button.
Minimal reproduction project
N/A

Seem to happen only when opening the color picker by double clicking. Does not happen in a single window mode (editor setting interface/editor/single_window_mode = true).
In action (only double clicked to open the color picker and then pressed Esc to close it, no more presses involved):

I can see the issue. Is the expected behaviour here to 1) create a gradient key on the position that was double-clicked, 2) open the colour picker, and 3) never allow the gradient key position to move on this process? If so I have a fix for this :)
Here's the potentially fixed behaviour in action:

Is the expected behaviour here to 1) create a gradient key on the position that was double-clicked, 2) open the colour picker, and 3) never allow the gradient key position to move on this process?

Yes, yes, yes.

If so I have a fix for this :)

Feel free to open a PR (no need to ask for permission). :slightly_smiling_face:

authors: AleCamara kleonc mrjustaguy


text:
Floor not detected and movement is glitchy

Godot version
Godot 4 Beta 3
System information
Ubuntu 22.04 Running on Vulkan Mesa Intel® UHD Graphics 620 (WHL GT2)
Issue description
So back in Godot 3, I also had a similar issue. All I did was to add Vector2.UP to the 2nd param of MoveAndSlide()
Now in Godot 4, there is no parameters for MoveAndSlide()
Jump doesn't work as an result of this.
Also, the movement just stops after you try to move around for a bit; I think its when u change direction of movement on the ground
Steps to reproduce
Clone https://github.com/coder2195text/tile-craft
Set a breakpoint at Scripts/GameScene/Player.cs at line 31.
Play the game.
When you press jump, something like this should appear

For the movement testing, let the player touch the ground, move left then move right.
Minimal reproduction project
No response

The project linked is not a minimal reproduction project.
Please create a minimal reproduction project in GDScript instead of C# for two reasons:

Non-Mono builds of Godot are easier to set up and have less moving parts.
This rules out C# being the cause of the bug.

The project linked is not a minimal reproduction project.
Please create a minimal reproduction project in GDScript instead of C# for two reasons:

Non-Mono builds of Godot are easier to set up and have less moving parts.
This rules out C# being the cause of the bug.

While doing this, I found something else
Creating a new project gives me these attrs for CharacterBody2d

Transfering one apparently glitches it out cuz up direction doesnt exist

Moving left stops the sprite like touching wall, but moving right doesn't do that
Reproduction project
sadssdad.zip

Apparently everything works now because I changed floating mode to grounded mode


text:
Godot 4.2 Dev 4 breaks colour  ramp for GPU particles

Godot version
4.1.1.stable.mono, 4.2dev3, 4.2dev4
System information
Fedora Linux 38 (Workstation Edition)
Issue description
Self explanatory title. GPUparticles shaders do not correctly apply their colour ramp or initlal colour ramp to the particles.
Stable 4.1.1

Dev3

Dev4

The right side is a CPUParticle and is just there for comparison
Steps to reproduce
Add a GPUParticles node with a default material, and adjust colour ramp to see the effect ( or lack thereof )
Minimal reproduction project
Not necessary.

Thanks for the report! Consolidating in https://github.com/godotengine/godot/issues/81166, which was fixed by https://github.com/godotengine/godot/pull/81198 and will be in 4.2.dev5.


text:
MultiMesh won't display in web (MultiMeshInstance2D & RenderingServer)

Godot version
v4.1.1.stable.official [bd6af8e0e]
System information
Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Compatibility) - NVIDIA GeForce GTX 1660 SUPER (NVIDIA; 31.0.15.3623) - 11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 Threads)
Issue description
Browser receives errors when trying to use both MultiMeshInstance2D and RenderingServer.multimesh_*
Chrome - Version 116.0.5845.188 (Official Build) (64-bit):
[.WebGL-00007DF006C86900] GL_INVALID_OPERATION: Vertex shader input type does not match the type of the bound vertex attribute.

Firefox - 117.0.1 (64-bit):
WebGL warning: drawElementsInstanced: Vertex attrib 5 requires data of type UINT, but is being supplied with type FLOAT.

Steps to reproduce
Can view files and Itch.IO project here - https://quietgodot.itch.io/web-multimesh?secret=hyR14x8ZiMmxMP6X4rx9476fmTo
Was using the following minimal code:
For MultiMeshInstance2D
func _ready() -> void:
	for index in multimesh.instance_count:
		multimesh.set_instance_transform_2d(index, Transform2D(0, Vector2(index * 16 + 16, 16)))

For RenderingServer
var unit_texture: Texture2D = preload("icon.svg")
var unit_size: Vector2 = Vector2(16.0, 16.0)
var unit_mid: Vector2 = Vector2(8.0, 8.0)
var unit_count: int = 100

var quad_mesh: QuadMesh = QuadMesh.new()
var unit_rid: RID = RenderingServer.canvas_item_create()
var mesh_rid: RID = RenderingServer.multimesh_create()

func _ready() -> void:
	quad_mesh.size = unit_size
	quad_mesh.center_offset = Vector3(unit_mid.x, unit_mid.y, 0.0)
	RenderingServer.multimesh_set_mesh(mesh_rid, quad_mesh.get_rid())
	RenderingServer.multimesh_allocate_data(mesh_rid, unit_count, RenderingServer.MULTIMESH_TRANSFORM_2D)
	RenderingServer.canvas_item_set_parent(unit_rid, get_canvas_item())

	for unit_index in unit_count:
		RenderingServer.multimesh_instance_set_transform_2d(mesh_rid, unit_index, Transform2D(0, Vector2(randi() % 1025, randi() % 769)))

	RenderingServer.canvas_item_add_multimesh(unit_rid, mesh_rid, unit_texture)

Minimal reproduction project
project.zip

Id 457205697
Email @.***
On Tue, Sep 19, 2023, 7:41 PM Pizza-Script @.***> wrote:

Godot version
v4.1.1.stable.official [bd6af8e
https://github.com/godotengine/godot/commit/bd6af8e0ea69167dd0627f3bd54f9105bda0f8b5
]
System information
Godot v4.1.1.stable - Windows 10.0.19045 - Vulkan (Compatibility) - NVIDIA
GeForce GTX 1660 SUPER (NVIDIA; 31.0.15.3623) - 11th Gen Intel(R) Core(TM)
i7-11700 @ 2.50GHz (16 Threads)
Issue description
Browser receives errors when trying to use both MultiMeshInstance2D and
RenderingServer.multimesh_*
Chrome - Version 116.0.5845.188 (Official Build) (64-bit):
[.WebGL-00007DF006C86900] GL_INVALID_OPERATION: Vertex shader input type
does not match the type of the bound vertex attribute.
[image: 01 Chrome]
https://user-images.githubusercontent.com/49001332/268972789-6dab42c6-2bb2-4d73-b852-0522b9374de1.png
Firefox - 117.0.1 (64-bit):
WebGL warning: drawElementsInstanced: Vertex attrib 5 requires data of
type UINT, but is being supplied with type FLOAT.
[image: 01 Firefox]
https://user-images.githubusercontent.com/49001332/268972854-5b4e7957-961e-4375-823d-2c2f820bd7e1.png
Steps to reproduce
Can view files and Itch.IO project here -
https://quietgodot.itch.io/web-multimesh?secret=hyR14x8ZiMmxMP6X4rx9476fmTo
Was using the following minimal code:
For MultiMeshInstance2D
func _ready() -> void:
for index in multimesh.instance_count:
multimesh.set_instance_transform_2d(index, Transform2D(0, Vector2(index * 16 + 16, 16)))
For RenderingServer
var unit_texture: Texture2D = preload("icon.svg")
var unit_size: Vector2 = Vector2(16.0, 16.0)
var unit_mid: Vector2 = Vector2(8.0, 8.0)
var unit_count: int = 100
var quad_mesh: QuadMesh = QuadMesh.new()
var unit_rid: RID = RenderingServer.canvas_item_create()
var mesh_rid: RID = RenderingServer.multimesh_create()
func _ready() -> void:
quad_mesh.size = unit_size
quad_mesh.center_offset = Vector3(unit_mid.x, unit_mid.y, 0.0)
RenderingServer.multimesh_set_mesh(mesh_rid, quad_mesh.get_rid())
RenderingServer.multimesh_allocate_data(mesh_rid, unit_count, RenderingServer.MULTIMESH_TRANSFORM_2D)
RenderingServer.canvas_item_set_parent(unit_rid, get_canvas_item())
for unit_index in unit_count:
RenderingServer.multimesh_instance_set_transform_2d(mesh_rid, unit_index, Transform2D(0, Vector2(randi() % 1025, randi() % 769)))
RenderingServer.canvas_item_add_multimesh(unit_rid, mesh_rid, unit_texture)
Minimal reproduction project
project.zip
https://github.com/godotengine/godot/files/12660765/project.zip
—
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/81926, or unsubscribe
https://github.com/notifications/unsubscribe-auth/BCGSWF6WVIGOWZADOJOSJP3X3GOI3ANCNFSM6AAAAAA46JSGSA
.
You are receiving this because you are subscribed to this thread.Message
ID: @.***>

Thanks for the report. Looks like a 2D version bug report of https://github.com/godotengine/godot/issues/80980 (GridMap uses MultiMeshInstance internally), both of these should be fixed by https://github.com/godotengine/godot/pull/81575
I'll keep this open as it is still slighly different from the other report and is also directly about 2D and MultiMesh.

authors: 457205697 Pizza-Script bitsawer