Ejemplo n.º 1
0
        static ColumnStat PrestoFormatConvert(PrestoColumnStats stat_in, int nRows)
        {
            ColumnStat stat = new ColumnStat();

            stat.nullfrac_   = (double)stat_in.nullsCount / (double)nRows;
            stat.n_rows_     = (ulong)nRows;
            stat.n_distinct_ = (ulong)stat_in.distinctValuesCount;
            stat.mcv_        = null;
            stat.hist_       = null;

            return(stat);
        }
Ejemplo n.º 2
0
        static ColumnStat PrestoFormatConvert(PrestoColumnStats stat_in, int nRows)
        {
            ColumnStat stat = new ColumnStat
            {
                nullfrac_   = (double)stat_in.nullsCount_ / (double)nRows,
                n_rows_     = (ulong)nRows,
                n_distinct_ = (ulong)stat_in.distinctValuesCount_,
                mcv_        = null,
                hist_       = null
            };

            return(stat);
        }
Ejemplo n.º 3
0
        static void createOptimizerTables()
        {
            List <ColumnDef> cols = new List <ColumnDef> {
                new ColumnDef("i", 0)
            };

            for (int i = 0; i < 30; i++)
            {
                Catalog.systable_.CreateTable($"T{i}", cols, null);
                var stat = new ColumnStat();
                stat.n_rows_ = 1 + i * 10;
                Catalog.sysstat_.AddOrUpdate($"T{i}", "i", stat);
            }
        }
Ejemplo n.º 4
0
        static void createOptimizerTestTables()
        {
            List <ColumnDef> cols = new List <ColumnDef> {
                new ColumnDef("i", new IntType(), 0)
            };

            for (int i = 0; i < 30; i++)
            {
                Catalog.systable_.CreateTable($"T{i}", cols, null);
                var stat = new ColumnStat
                {
                    n_rows_ = (ulong)(1 + i * 10)
                };
                Catalog.sysstat_.AddOrUpdate($"T{i}", "i", stat);
            }
        }
Ejemplo n.º 5
0
        static public void ReadConvertPrestoStats(string stats_dir_fn)
        {
            string[] statFiles = Directory.GetFiles(stats_dir_fn);

            foreach (string statFn in statFiles)
            {
                PrestoTable currentTable = new PrestoTable(statFn);
                currentTable.name = Path.GetFileNameWithoutExtension(statFn);

                string jsonStr        = File.ReadAllText(statFn);
                string trimmedJsonStr = Regex.Replace(jsonStr, "\\n", "");
                trimmedJsonStr = Regex.Replace(trimmedJsonStr, "\\r", "");

                currentTable.contents = JsonSerializer.Deserialize <PrestoTableStats>(trimmedJsonStr);

                foreach (KeyValuePair <string, PrestoColumnStats> kvp in currentTable.contents.columns)
                {
                    ColumnStat stat = PrestoFormatConvert(kvp.Value, currentTable.contents.rowCount);
                    Catalog.sysstat_.AddOrUpdate(currentTable.name, kvp.Key, stat);
                }
            }
        }