com.snowflake.snowpark.custom.SnowparkUtils.scala Maven / Gradle / Ivy
/*
* Smart Data Lake - Build your data lake the smart way.
*
* Copyright © 2019-2023 ELCA Informatique SA ()
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package com.snowflake.snowpark.custom
import com.snowflake.snowpark.Column.expr
import com.snowflake.snowpark.{DataFrame, Window}
import com.snowflake.snowpark.functions.{col, row_number}
import com.snowflake.snowpark.types.{DataType, NumericType, StructType}
object SnowparkUtils {
def isNumeric(dataType: DataType) = dataType.isInstanceOf[NumericType]
def showString(df: DataFrame, numRows: Int = 10, width: Int = 200): String = df.showString(numRows, width)
def explainString(df: DataFrame): String = df.explainString
def schemaTreeString(schema: StructType, level: Int = Int.MaxValue): String = schema.treeString(level)
}