@@ -47,8 +47,8 @@ func TestLiteralToString(t *testing.T) {
4747		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionMilliSeconds , types .NullabilityNullable ), "precision_timestamp_tz?<3>(1970-01-01T00:02:03.456Z)" },
4848		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionMicroSeconds , types .NullabilityNullable ), "precision_timestamp_tz?<6>(1970-01-01T00:00:00.123456Z)" },
4949		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionNanoSeconds , types .NullabilityNullable ), "precision_timestamp_tz?<9>(1970-01-01T00:00:00.000123456Z)" },
50- 		{MustLiteral (literal .NewDecimalFromString ("12.345" )), "decimal<5,3>(12.345)" },
51- 		{MustLiteral (literal .NewDecimalFromString ("-12.345" )), "decimal<5,3>(-12.345)" },
50+ 		{MustLiteral (literal .NewDecimalFromString ("12.345" ,  false )), "decimal<5,3>(12.345)" },
51+ 		{MustLiteral (literal .NewDecimalFromString ("-12.345" ,  false )), "decimal<5,3>(-12.345)" },
5252	}
5353
5454	for  _ , tt  :=  range  tests  {
@@ -64,33 +64,32 @@ func TestLiteralToValueString(t *testing.T) {
6464		exp  string 
6565	}{
6666		{expr .NewNullLiteral (& types.Float32Type {}), "null" },
67- 		{literal .NewBool (true ), "true" },
68- 		{literal .NewInt8 (12 ), "12" },
67+ 		{literal .NewBool (true ,  false ), "true" },
68+ 		{literal .NewInt8 (12 ,  false ), "12" },
6969		{expr .NewPrimitiveLiteral [int8 ](0 , true ), "0" },
70- 		{literal .NewInt16 (0 ), "0" },
71- 		{literal .NewInt32 (99 ), "99" },
72- 		{literal .NewFloat32 (99.10 ), "99.1" },
73- 		{literal .NewFloat64 (99.20 ), "99.2" },
74- 		{literal .NewString ("99.30" ), "99.30" },
75- 		{MustLiteral (literal .NewDate (365 )), "1971-01-01" },
76- 		{MustLiteral (literal .NewTimeFromString ("12:34:56" )), "12:34:56" },
77- 		{MustLiteral (literal .NewTimestampFromString ("2021-03-05T12:34:56" )), "2021-03-05 12:34:56" },
78- 		{MustLiteral (literal .NewTimestampTZFromString ("2021-03-05T12:34:56" )), "2021-03-05T12:34:56Z" },
70+ 		{literal .NewInt16 (0 ,  false ), "0" },
71+ 		{literal .NewInt32 (99 ,  false ), "99" },
72+ 		{literal .NewFloat32 (99.10 ,  false ), "99.1" },
73+ 		{literal .NewFloat64 (99.20 ,  false ), "99.2" },
74+ 		{literal .NewString ("99.30" ,  false ), "99.30" },
75+ 		{MustLiteral (literal .NewDate (365 ,  false )), "1971-01-01" },
76+ 		{MustLiteral (literal .NewTimeFromString ("12:34:56" ,  false )), "12:34:56" },
77+ 		{MustLiteral (literal .NewTimestampFromString ("2021-03-05T12:34:56" ,  false )), "2021-03-05 12:34:56" },
78+ 		{MustLiteral (literal .NewTimestampTZFromString ("2021-03-05T12:34:56" ,  false )), "2021-03-05T12:34:56Z" },
7979		// Test the first implementation. 
80- 		{MustLiteral (literal .NewIntervalYearsToMonth (5 , 4 )), "5 years, 4 months" },
80+ 		{MustLiteral (literal .NewIntervalYearsToMonth (5 , 4 ,  false )), "5 years, 4 months" },
8181		// Test the other implementation. 
8282		{& expr.IntervalYearToMonthLiteral {Years : 7 , Months : 6 }, "7 years, 6 months" },
83- 		{MustLiteral (literal .NewIntervalDaysToSecond (5 , 4 , 3 )), "5 days, 4 seconds, 3 subseconds" },
83+ 		{MustLiteral (literal .NewIntervalDaysToSecond (5 , 4 , 3 ,  false )), "5 days, 4 seconds, 3 subseconds" },
8484		{t : & expr.IntervalCompoundLiteral {
8585			Years : 5 , Months : 4 , Days : 3 ,
8686			Seconds : 2 , SubSeconds : 1 , SubSecondPrecision : types .PrecisionMicroSeconds ,
8787			Nullability : types .NullabilityRequired }, exp : "5 years, 4 months, 3 days, 2 seconds, 1 subseconds" },
88- 		{MustLiteral (literal .NewUUIDFromBytes (
89- 			[]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 })),
88+ 		{MustLiteral (literal .NewUUIDFromBytes ([]byte {1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 }, false )),
9089			"01020304-0506-0708-090a-0b0c0d0e0f10" },
91- 		{MustLiteral (literal .NewFixedChar ("text" )), "text" },
92- 		{MustLiteral (literal .NewFixedBinary ([]byte {1 , 2 , 3 })), "0x010203" },
93- 		{MustLiteral (literal .NewVarChar ("vartext" )), "vartext" },
90+ 		{MustLiteral (literal .NewFixedChar ("text" ,  false )), "text" },
91+ 		{MustLiteral (literal .NewFixedBinary ([]byte {1 , 2 , 3 },  false )), "0x010203" },
92+ 		{MustLiteral (literal .NewVarChar ("vartext" ,  false )), "vartext" },
9493		{expr .NewNestedLiteral (expr.ListLiteralValue {
9594			expr .NewNestedLiteral (expr.MapLiteralValue {
9695				{
@@ -135,9 +134,9 @@ func TestLiteralToValueString(t *testing.T) {
135134		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionEMinus7Seconds , types .NullabilityNullable ), "1970-01-01T00:00:00.0123456Z" },
136135		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionEMinus8Seconds , types .NullabilityNullable ), "1970-01-01T00:00:00.00123456Z" },
137136		{expr .NewPrecisionTimestampTzLiteral (123456 , types .PrecisionNanoSeconds , types .NullabilityNullable ), "1970-01-01T00:00:00.000123456Z" },
138- 		{MustLiteral (literal .NewDecimalFromString ("12.345" )), "12.345" },
139- 		{MustLiteral (literal .NewDecimalFromString ("-12.345" )), "-12.345" },
140- 		{MustLiteral (literal .NewList ([]expr.Literal {literal .NewInt8 (2 ), literal .NewInt8 (4 ), literal .NewInt8 (6 )} )), "[2, 4, 6]" },
137+ 		{MustLiteral (literal .NewDecimalFromString ("12.345" ,  false )), "12.345" },
138+ 		{MustLiteral (literal .NewDecimalFromString ("-12.345" ,  false )), "-12.345" },
139+ 		{MustLiteral (literal .NewList ([]expr.Literal {literal .NewInt8 (2 ,  false ), literal .NewInt8 (4 ,  false ), literal .NewInt8 (6 ,  false )},  false )), "[2, 4, 6]" },
141140	}
142141
143142	for  _ , tt  :=  range  tests  {
@@ -148,7 +147,7 @@ func TestLiteralToValueString(t *testing.T) {
148147}
149148
150149func  TestLiteralToStringBrokenDecimal (t  * testing.T ) {
151- 	brokenDecimalLit , _  :=  literal .NewDecimalFromString ("1234.56" )
150+ 	brokenDecimalLit , _  :=  literal .NewDecimalFromString ("1234.56" ,  false )
152151	brokenDecimalLitAsProtoLit  :=  brokenDecimalLit .(* expr.ProtoLiteral )
153152	brokenDecimalLitAsProtoLit .Value  =  []byte {1 , 2 , 3 }
154153
0 commit comments