github.com/dolthub/go-mysql-server@v0.18.0/sql/expression/function/format_test.go (about)

     1  // Copyright 2021 Dolthub, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package function
    16  
    17  import (
    18  	"testing"
    19  
    20  	"github.com/stretchr/testify/require"
    21  	"gopkg.in/src-d/go-errors.v1"
    22  
    23  	"github.com/dolthub/go-mysql-server/sql"
    24  	"github.com/dolthub/go-mysql-server/sql/expression"
    25  	"github.com/dolthub/go-mysql-server/sql/types"
    26  )
    27  
    28  func TestFormat(t *testing.T) {
    29  	testCases := []struct {
    30  		name     string
    31  		xType    sql.Type
    32  		dType    sql.Type
    33  		row      sql.Row
    34  		expected interface{}
    35  		err      *errors.Kind
    36  	}{
    37  		{"float64 is nil", types.Float64, types.Int32, sql.NewRow(nil, nil, nil), nil, nil},
    38  		{"float64 without d", types.Float64, types.Int32, sql.NewRow(5555.8, nil, nil), nil, nil},
    39  		{"float64 with d", types.Float64, types.Int32, sql.NewRow(5555.855, 4, nil), "5,555.8550", nil},
    40  		{"float64 with super big decimal place", types.Float64, types.Int32, sql.NewRow(5555.855, 15, nil), "5,555.855000000000000", nil},
    41  		{"float64 with negative d", types.Float64, types.Int32, sql.NewRow(5552.855, -1, nil), "5,553", nil},
    42  		{"float64 with float d", types.Float64, types.Float64, sql.NewRow(5555.855, float64(2.123), nil), "5,555.86", nil},
    43  		{"float64 with float negative d", types.Float64, types.Float64, sql.NewRow(5552.855, float64(-1), nil), "5,553", nil},
    44  		{"float64 with blob d", types.Float64, types.Blob, sql.NewRow(5555.855, []byte{1, 2, 3}, nil), "5,555.855000000000500000000000000000", nil},
    45  		{"float64 with text d", types.Float64, types.Text, sql.NewRow(5555.855, "2", nil), "5,555.86", nil},
    46  		{"negative float64 with d", types.Float64, types.Int32, sql.NewRow(-5555.855, 2, nil), "-5,555.86", nil},
    47  		{"blob is nil", types.Blob, types.Int32, sql.NewRow(nil, nil, nil), nil, nil},
    48  		{"blob is ok", types.Blob, types.Int32, sql.NewRow([]byte{1, 2, 3}, nil, nil), nil, nil},
    49  		{"text int without d", types.Text, types.Int32, sql.NewRow("98765432", nil, nil), nil, nil},
    50  		{"text int with d", types.Text, types.Int32, sql.NewRow("98765432", 2, nil), "98,765,432.00", nil},
    51  		{"text int with negative d", types.Text, types.Int32, sql.NewRow("98765432", -1, nil), "98,765,432", nil},
    52  		{"text int with float d", types.Text, types.Float64, sql.NewRow("98765432", 2.123, nil), "98,765,432.00", nil},
    53  		{"text int with float negative d", types.Text, types.Float64, sql.NewRow("98765432", float32(-1), nil), "98,765,432", nil},
    54  		{"text float without d", types.Text, types.Int32, sql.NewRow("98765432.1234", nil, nil), nil, nil},
    55  		{"text float with d", types.Text, types.Int32, sql.NewRow("98765432.1234", 2, nil), "98,765,432.12", nil},
    56  		{"text float with negative d", types.Text, types.Int32, sql.NewRow("98765432.8234", -1, nil), "98,765,433", nil},
    57  		{"text float with float d", types.Text, types.Float64, sql.NewRow("98765432.1234", float64(2.823), nil), "98,765,432.123", nil},
    58  		{"text float with float negative d", types.Text, types.Float64, sql.NewRow("98765432.1234", float64(-1), nil), "98,765,432", nil},
    59  		{"text float with blob d", types.Text, types.Blob, sql.NewRow("98765432.1234", []byte{1, 2, 3}, nil), "98,765,432.123400020000000000000000000000", nil},
    60  		{"negative num text int with d", types.Text, types.Int32, sql.NewRow("-98765432", 2, nil), "-98,765,432.00", nil},
    61  		{"sci-notn big num", types.Float64, types.Int32, sql.NewRow(5932886+.000000000001, 1, nil), "5,932,886.0", nil},
    62  		{"sci-notn big num with big dp", types.Float64, types.Int32, sql.NewRow(5932886+.000000000001, 8, nil), "5,932,886.00000000", nil},
    63  		{"sci-notn big exp num", types.Float64, types.Int32, sql.NewRow(5.932887e+08, 2, nil), "593,288,700.00", nil},
    64  		{"sci-notn neg big exp num", types.Float64, types.Int32, sql.NewRow(-5.932887e+08, 2, nil), "-593,288,700.00", nil},
    65  		{"sci-notn text big exp num", types.Text, types.Int32, sql.NewRow("5.932887e+07", 3, nil), "59,328,870.000", nil},
    66  		{"sci-notn text neg big exp num", types.Text, types.Int32, sql.NewRow("-5.932887e+08", 2, nil), "-593,288,700.00", nil},
    67  		{"sci-notn exp small num", types.Float64, types.Int32, sql.NewRow(5.932887e-08, 2, nil), "0.00", nil},
    68  		{"sci-notn exp small num with big dp", types.Float64, types.Int32, sql.NewRow(5.932887e-08, 9, nil), "0.000000059", nil},
    69  		{"sci-notn neg exp small num", types.Float64, types.Int32, sql.NewRow(-5.932887e-08, 2, nil), "0.00", nil},
    70  		{"sci-notn neg exp small num with big dp", types.Float64, types.Int32, sql.NewRow(-5.932887e-08, 8, nil), "-0.00000006", nil},
    71  		{"sci-notn text neg exp small num", types.Float64, types.Int32, sql.NewRow("-5.932887e-08", 2, nil), "0.00", nil},
    72  		{"sci-notn text neg exp small num with big dp", types.Float64, types.Int32, sql.NewRow("-5.932887e-08", 8, nil), "-0.00000006", nil},
    73  		{"float64 with loc=ar_AE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_AE"), "2,409,384.8550", nil},
    74  		{"float64 with loc=ar_BH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_BH"), "2,409,384.8550", nil},
    75  		{"float64 with loc=ar_EG", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_EG"), "2,409,384.8550", nil},
    76  		{"float64 with loc=ar_IQ", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_IQ"), "2,409,384.8550", nil},
    77  		{"float64 with loc=ar_JO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_JO"), "2,409,384.8550", nil},
    78  		{"float64 with loc=ar_KW", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_KW"), "2,409,384.8550", nil},
    79  		{"float64 with loc=ar_OM", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_OM"), "2,409,384.8550", nil},
    80  		{"float64 with loc=ar_QA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_QA"), "2,409,384.8550", nil},
    81  		{"float64 with loc=ar_SD", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_SD"), "2,409,384.8550", nil},
    82  		{"float64 with loc=ar_SY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_SY"), "2,409,384.8550", nil},
    83  		{"float64 with loc=ar_YE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_YE"), "2,409,384.8550", nil},
    84  		{"float64 with loc=da_DK", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "da_DK"), "2.409.384,8550", nil},
    85  		{"float64 with loc=de_BE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "de_BE"), "2.409.384,8550", nil},
    86  		{"float64 with loc=de_DE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "de_DE"), "2.409.384,8550", nil},
    87  		{"float64 with loc=de_LU", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "de_LU"), "2.409.384,8550", nil},
    88  		{"float64 with loc=en_AU", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_AU"), "2,409,384.8550", nil},
    89  		{"float64 with loc=en_CA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_CA"), "2,409,384.8550", nil},
    90  		{"float64 with loc=en_GB", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_GB"), "2,409,384.8550", nil},
    91  		{"float64 with loc=en_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_IN"), "24,09,384.8550", nil},
    92  		{"float64 with loc=en_NZ", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_NZ"), "2,409,384.8550", nil},
    93  		{"float64 with loc=en_PH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_PH"), "2,409,384.8550", nil},
    94  		{"float64 with loc=en_US", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_US"), "2,409,384.8550", nil},
    95  		{"float64 with loc=en_ZW", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_ZW"), "2,409,384.8550", nil},
    96  		{"float64 with loc=es_AR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_AR"), "2.409.384,8550", nil},
    97  		{"float64 with loc=es_US", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_US"), "2,409,384.8550", nil},
    98  		{"float64 with loc=fo_FO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fo_FO"), "2.409.384,8550", nil},
    99  		{"float64 with loc=he_IL", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "he_IL"), "2,409,384.8550", nil},
   100  		{"float64 with loc=id_ID", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "id_ID"), "2.409.384,8550", nil},
   101  		{"float64 with loc=is_IS", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "is_IS"), "2.409.384,8550", nil},
   102  		{"float64 with loc=ja_JP", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ja_JP"), "2,409,384.8550", nil},
   103  		{"float64 with loc=ko_KR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ko_KR"), "2,409,384.8550", nil},
   104  		{"float64 with loc=ms_MY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ms_MY"), "2,409,384.8550", nil},
   105  		{"float64 with loc=ro_RO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ro_RO"), "2.409.384,8550", nil},
   106  		{"float64 with loc=ta_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ta_IN"), "24,09,384.8550", nil},
   107  		{"float64 with loc=th_TH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "th_TH"), "2,409,384.8550", nil},
   108  		{"float64 with loc=tr_TR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "tr_TR"), "2.409.384,8550", nil},
   109  		{"float64 with loc=ur_PK", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ur_PK"), "2,409,384.8550", nil},
   110  		{"float64 with loc=vi_VN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "vi_VN"), "2.409.384,8550", nil},
   111  		{"float64 with loc=zh_CN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "zh_CN"), "2,409,384.8550", nil},
   112  		{"float64 with loc=zh_HK", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "zh_HK"), "2,409,384.8550", nil},
   113  		{"float64 with loc=zh_TW", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "zh_TW"), "2,409,384.8550", nil},
   114  	}
   115  
   116  	for _, tt := range testCases {
   117  		var args = make([]sql.Expression, 3)
   118  		args[0] = expression.NewGetField(0, tt.xType, "Val", false)
   119  		args[1] = expression.NewGetField(1, tt.dType, "Df", false)
   120  		args[2] = expression.NewGetField(2, types.LongText, "Locale", true)
   121  		f, err := NewFormat(args...)
   122  
   123  		t.Run(tt.name, func(t *testing.T) {
   124  			require := require.New(t)
   125  			require.Nil(err)
   126  
   127  			result, err := f.Eval(sql.NewEmptyContext(), tt.row)
   128  			if tt.err != nil {
   129  				require.Error(err)
   130  				require.True(tt.err.Is(err))
   131  			} else {
   132  				require.NoError(err)
   133  				require.Equal(tt.expected, result)
   134  			}
   135  		})
   136  	}
   137  }
   138  
   139  // TestSkippedFormat contains all the skipped tests those are incompatible to mysql format function results.
   140  // These include handling text type scientific notation numbers and some locales do not match exactly to mysql format
   141  // results. Some issues include usage of non-ascii characters from language library used and incorrect general format.
   142  // For scietific notation issues:
   143  // FORMAT("5932886+.000000000001", 2) -> Expected: 5932886.00 	|	Actual: value conversion error
   144  // FORMAT(5932886+.000000000001, 15)  -> Expected: "5,932,886.000000000001000"	|	Actual: "5,932,886.000000000000000"
   145  // For some locale issues:
   146  //
   147  //	Expected		| 	Actual
   148  //	2409384,8550	|	2.409.384,8550
   149  //	2,409,384.8550	|	2 409 384,8550
   150  //	2,409,384.8550	|	2.409.384,8550
   151  //	2,409,384.8550	|	٢٬٤٠٩٬٣٨٤¡8550
   152  //	2'409'384.8550	|	2’409’384.8550
   153  func TestSkippedFormat(t *testing.T) {
   154  	testCases := []struct {
   155  		name     string
   156  		xType    sql.Type
   157  		dType    sql.Type
   158  		row      sql.Row
   159  		expected interface{}
   160  		err      *errors.Kind
   161  	}{
   162  		{"sci-notn big num with big dp", types.Float64, types.Int32, sql.NewRow(5932886+.000000000001, 15, nil), "5,932,886.000000000001000", nil},
   163  		{"sci-notn text big num", types.Text, types.Int32, sql.NewRow("5932886+.000000000001", 1, nil), "5,932,886.0", nil},
   164  		{"float64 with loc=ar_DZ", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_DZ"), "2,409,384.8550", nil},
   165  		{"float64 with loc=ar_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_IN"), "2,409,384.8550", nil},
   166  		{"float64 with loc=ar_LB", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_LB"), "2,409,384.8550", nil},
   167  		{"float64 with loc=ar_LY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_LY"), "2,409,384.8550", nil},
   168  		{"float64 with loc=ar_MA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_MA"), "2,409,384.8550", nil},
   169  		{"float64 with loc=ar_SA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_SA"), "2409384.8550", nil},
   170  		{"float64 with loc=ar_TN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ar_TN"), "2,409,384.8550", nil},
   171  		{"float64 with loc=be_BY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "be_BY"), "2.409.384,8550", nil},
   172  		{"float64 with loc=bg_BG", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "bg_BG"), "2409384,8550", nil},
   173  		{"float64 with loc=ca_ES", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ca_ES"), "2409384,8550", nil},
   174  		{"float64 with loc=cs_CZ", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "cs_CZ"), "2409384,8550", nil},
   175  		{"float64 with loc=de_AT", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "de_AT"), "2409384,8550", nil},
   176  		{"float64 with loc=de_CH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "de_CH"), "2'409'384.8550", nil},
   177  		{"float64 with loc=el_GR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "el_GR"), "2409384,8550", nil},
   178  		{"float64 with loc=en_ZA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "en_ZA"), "2,409,384.8550", nil},
   179  		{"float64 with loc=es_BO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_BO"), "2409384,8550", nil},
   180  		{"float64 with loc=es_CL", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_CL"), "2409384,8550", nil},
   181  		{"float64 with loc=es_CO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_CO"), "2409384,8550", nil},
   182  		{"float64 with loc=es_CR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_CR"), "2409384.8550", nil},
   183  		{"float64 with loc=es_DO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_DO"), "2409384.8550", nil},
   184  		{"float64 with loc=es_EC", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_EC"), "2409384,8550", nil},
   185  		{"float64 with loc=es_ES", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_ES"), "2409384,8550", nil},
   186  		{"float64 with loc=es_GT", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_GT"), "2409384.8550", nil},
   187  		{"float64 with loc=es_HN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_HN"), "2409384.8550", nil},
   188  		{"float64 with loc=es_MX", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_MX"), "2409384.8550", nil},
   189  		{"float64 with loc=es_NI", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_NI"), "2409384.8550", nil},
   190  		{"float64 with loc=es_PA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_PA"), "2409384.8550", nil},
   191  		{"float64 with loc=es_PE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_PE"), "2409384.8550", nil},
   192  		{"float64 with loc=es_PR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_PR"), "2409384.8550", nil},
   193  		{"float64 with loc=es_PY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_PY"), "2409384,8550", nil},
   194  		{"float64 with loc=es_SV", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_SV"), "2409384.8550", nil},
   195  		{"float64 with loc=es_UY", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_UY"), "2409384,8550", nil},
   196  		{"float64 with loc=es_VE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "es_VE"), "2409384,8550", nil},
   197  		{"float64 with loc=et_EE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "et_EE"), "2 409 384,8550", nil},
   198  		{"float64 with loc=eu_ES", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "eu_ES"), "2409384,8550", nil},
   199  		{"float64 with loc=fi_FI", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fi_FI"), "2 409 384,8550", nil},
   200  		{"float64 with loc=fr_BE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fr_BE"), "2409384,8550", nil},
   201  		{"float64 with loc=fr_CA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fr_CA"), "2409384,8550", nil},
   202  		{"float64 with loc=fr_CH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fr_CH"), "2409384,8550", nil},
   203  		{"float64 with loc=fr_FR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fr_FR"), "2409384,8550", nil},
   204  		{"float64 with loc=fr_LU", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "fr_LU"), "2409384,8550", nil},
   205  		{"float64 with loc=gl_ES", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "gl_ES"), "2409384,8550", nil},
   206  		{"float64 with loc=gu_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "gu_IN"), "2,409,384.8550", nil},
   207  		{"float64 with loc=hi_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "hi_IN"), "2,409,384.8550", nil},
   208  		{"float64 with loc=hr_HR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "hr_HR"), "2409384,8550", nil},
   209  		{"float64 with loc=hu_HU", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "hu_HU"), "2.409.384,8550", nil},
   210  		{"float64 with loc=it_CH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "it_CH"), "2'409'384,8550", nil},
   211  		{"float64 with loc=it_IT", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "it_IT"), "2409384,8550", nil},
   212  		{"float64 with loc=lt_LT", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "lt_LT"), "2.409.384,8550", nil},
   213  		{"float64 with loc=lv_LV", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "lv_LV"), "2 409 384,8550", nil},
   214  		{"float64 with loc=mk_MK", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "mk_MK"), "2 409 384,8550", nil},
   215  		{"float64 with loc=mn_MN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "mn_MN"), "2.409.384,8550", nil},
   216  		{"float64 with loc=nb_NO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "nb_NO"), "2.409.384,8550", nil},
   217  		{"float64 with loc=nl_BE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "nl_BE"), "2409384,8550", nil},
   218  		{"float64 with loc=nl_NL", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "nl_NL"), "2409384,8550", nil},
   219  		{"float64 with loc=no_NO", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "no_NO"), "2.409.384,8550", nil},
   220  		{"float64 with loc=pl_PL", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "pl_PL"), "2409384,8550", nil},
   221  		{"float64 with loc=pt_BR", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "pt_BR"), "2409384,8550", nil},
   222  		{"float64 with loc=pt_PT", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "pt_PT"), "2409384,8550", nil},
   223  		{"float64 with loc=rm_CH", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "rm_CH"), "2'409'384,8550", nil},
   224  		{"float64 with loc=ru_RU", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ru_RU"), "2 409 384,8550", nil},
   225  		{"float64 with loc=ru_UA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "ru_UA"), "2.409.384,8550", nil},
   226  		{"float64 with loc=sk_SK", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sk_SK"), "2 409 384,8550", nil},
   227  		{"float64 with loc=sl_SI", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sl_SI"), "2409384,8550", nil},
   228  		{"float64 with loc=sq_AL", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sq_AL"), "2.409.384,8550", nil},
   229  		{"float64 with loc=sr_RS", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sr_RS"), "2409384.8550", nil},
   230  		{"float64 with loc=sv_FI", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sv_FI"), "2 409 384,8550", nil},
   231  		{"float64 with loc=sv_SE", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "sv_SE"), "2 409 384,8550", nil},
   232  		{"float64 with loc=te_IN", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "te_IN"), "24,09,384.8550", nil},
   233  		{"float64 with loc=uk_UA", types.Float64, types.Int32, sql.NewRow(2409384.855, 4, "uk_UA"), "2.409.384,8550", nil},
   234  	}
   235  
   236  	for _, tt := range testCases {
   237  		var args = make([]sql.Expression, 3)
   238  		args[0] = expression.NewGetField(0, tt.xType, "Val", false)
   239  		args[1] = expression.NewGetField(1, tt.dType, "Df", false)
   240  		args[2] = expression.NewGetField(2, types.LongText, "Locale", true)
   241  		f, err := NewFormat(args...)
   242  
   243  		t.Run(tt.name, func(t *testing.T) {
   244  			t.Skip()
   245  			require := require.New(t)
   246  			require.Nil(err)
   247  
   248  			result, err := f.Eval(sql.NewEmptyContext(), tt.row)
   249  			if tt.err != nil {
   250  				require.Error(err)
   251  				require.True(tt.err.Is(err))
   252  			} else {
   253  				require.NoError(err)
   254  				require.Equal(tt.expected, result)
   255  			}
   256  		})
   257  	}
   258  }