Importieren großer Parquet-Dateien in JMPHallo,
Ich muss große Datensätze im Parquet-Format (möglicherweise mehrere GB) effizient in JMP importieren. Ich habe mir hier das Anleitungsvideo zum CSV-Import angesehen und stattdessen denselben Ansatz mit pd.read_parquet verwendet. Meine Sorge ist in diesem Fall, dass der Import sehr ineffizient sein wird, da die Tabellen sowohl als Pandas-DF-Objekt als auch als JMP-DT Speicher belegen müssen. Gibt es einen besseren Ansatz, der für PCs mit bescheidenen Spezifikationen besser geeignet ist?
Vielen Dank.
Automatisierung und SkriptingWindowsBetreff: Große Parquet-Dateien in JMP importierenZuallererst: Sie benötigen ausreichend RAM, mindestens doppelt so groß wie die Binärdatei, wahrscheinlich sogar dreimal so groß oder mehr, um die Konvertierung direkt von Parquet in die JMP-Datentabelle im Arbeitsspeicher durchführen zu können. Verwenden Sie die Python-Integration und das PyArrow-Python-Paket.
import jmp
from jmputils import jpip
jpip('install','pyarrow')
Hier ist ein Beispielskript für JMP 18, das direkt eine Parquet-Datei durchläuft und mit den Daten eine Datentabelle aus Python erstellt, alles im Arbeitsspeicher.
In JMP 18 müssen Sie dann jede Spalte der Daten- und Datentabellenspalte einzeln von Python aus durchlaufen. Sie können das Parquet-Schema und die Daten direkt durchlaufen oder die Parquet-Tabelle in einen Pandas-Datenrahmen konvertieren. Ein Beispiel für die Konvertierung eines Pandas-Datenrahmens in ein jmp.DataTable-Objekt finden Sie in den Skripten $SAMPLE_SCRIPTS/Python/dt2pandas2dt.jsl und .py.
# parquet.py
# Author: Paul R. Nelson
# JMP Statistical Discovery LLC
#
# Description:
# Directly read a pyarrow table and create a JMP datatable.
# The data for this file comes from a repository that is Apache licensed.
# https://github.com/Teradata/kylo/blob/master/samples/sample-data/parquet/userdata1.parquet
#
import jmp
import pyarrow.parquet as pq
ver = jmp.__version__.split('.')
if(ver[0] == '0' and ver[1] < '5'):
print('This version requires JMP 18.0 EA-5 or newer.')
pq_Table = pq.read_table('/Your_path/to/userdata1.parquet')
#print(pq_Table)
print(f'Table Rows: {len(pq_Table)}' )
print(f'Table Shape: {pq_Table.shape}')
print(f'Table Schema:\n{pq_Table.schema}')
print(f'Column Names: {pq_Table.column_names}')
#print(pq_Table.columns)
print(f'Num Columns: {pq_Table.num_columns}')
dt = jmp.DataTable('From Parquet', pq_Table.num_rows)
dt.new_column('first_name', jmp.DataType.Character)
dt.new_column('last_name', jmp.DataType.Character)
dt.new_column('Salary')
# set column properites (widths)
jmp.run_jsl('''
// Change column display width: last_name
Data Table( "From Parquet" ):last_name << Set Display Width( 105 );
// Change column display width: Salary
Data Table( "From Parquet" ):Salary << Set Display Width( 90 );
''')
#Create a data table column from a Python list
dt[0] = pq_Table.column(2).to_pylist()
dt[1] = pq_Table.column(3).to_pylist()
dt[2] = pq_Table.column(10).to_pylist()
# ===================================================================================
# Copyright © 2025 JMP Statistical Discovery LLC, Cary, NC, USA. All rights reserved.
#
# JMP STATISTICAL DISCOVERY LLC ("JMP") PERMITS THE USE OF THIS COMPUTER SOFTWARE
# CODE ("CODE") ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO
# THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE
# OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE,
# WITH RESPECT TO THE CODE.
#
# You may use the Code solely as part of a software product you currently have
# licensed from JMP, JMP's parent company, SAS Institute Inc. ("SAS US") or one
# of SAS' subsidiaries (together with SAS US, "SAS") or authorized agents (the
# "Software"), and not for any other purpose. The Code is designed to either
# correct an error in the Software or to add functionality to the Software but
# has not necessarily been tested. Accordingly, JMP makes no representation or
# warranty that the Code (1) will operate error-free or (2) will not contain any
# viruses or other applications or executables (including, without limitation,
# any "trap doors," "worms" and "time bombs") that will degrade or infect any
# software product that you license from JMP or any other software or your
# network or systems. JMP is under no obligation to maintain, support, or
# continue to distribute the Code.
#
# Neither JMP nor its licensors shall be liable to you or any third party for any
# general, special, direct, indirect, consequential, incidental, or other damages
# whatsoever arising out of or related to your use or inability to use the Code,
# even if JMP has been advised of the possibility of such damages. Except as
# otherwise provided above, the Code is governed by the same agreement that
# governs the Software. If you do not have an existing agreement with JMP or SAS
# governing the Software, you may not use the Code.
#
# US export laws and regulations apply to the Code and any other JMP-provided
# technology ("Controlled Material"). The Controlled Material originates from the
# United States. Customer agrees to comply with these and other applicable export
# and import laws and regulations, except as prohibited or penalized by law
# ("Trade Law"). Customer warrants that Customer and its users are not: (a)
# prohibited by Trade Law from accessing Controlled Material without US
# government approval; (b) located in or under control of any country or other
# territory subject to general export or trade embargo under Trade Law; or (c)
# engaged in any of the following end-uses: nuclear, chemical or biological
# weapons; nuclear facilities not under International Atomic Energy Agency
# safeguards; missiles or unmanned aerial vehicles capable of long-range use or
# weapons delivery, military training or assistance, military or intelligence
# end-use in Russia or in any country in Country Group D:5 of the United States
# Export Administration Regulations; deep water, Arctic offshore or shale oil or
# gas exploration involving Russia or Russian companies, or Russian energy export
# pipelines. Customer will not import or use any data within the System that is
# subject to the US International Traffic Arms Regulations. United States export
# classification information for JMP software and its affiliates is available at
# jmp.com/export.
#
# JMP and all other JMP Statistical Discovery LLC product or service names are
# registered trademarks or trademarks of SAS Institute Inc. in the USA and other
# countries. ® indicates USA registration. Other brand and product names are
# registered trademarks or trademarks of their respective companies.
#
# ===================================================================================
Bei JMP 19 EA-4+ ist die Situation viel besser.
import jmp
import numpy as np
import pandas as pd
import pyarrow.parquet as pq
#parque sample files from
# https://github.com/Teradata/kylo/tree/master/samples/sample-data/parquet
pq_Table = pq.read_table('/Your_path/to/userdata1.parquet')
pd_table = pq_Table.to_pandas()
#create table in memory from pandas datadata frame.
dt = jmp.from_dataframe(pd_table)
#Same Disclaimer applies.
Betreff: Große Parquet-Dateien in JMP importierenDer Python-Ansatz ist wahrscheinlich besser als der folgende. Aber das funktioniert, zumindest mit einer Toy-Parquet-Datei.
Es gibt ein Apache Drill-Projekt, das Parquet-Dateien lesen kann. Es soll ein JDBC-Projekt sein (Java, leider kein ODBC), und die ODBC-Treiber dafür sind, falls sie noch existieren, möglicherweise nicht kostenlos. Es verfügt jedoch über eine REST-basierte API, und JSL kann das.
Die Schritte 1, 2 und 3 dieses Beitrags wiesen in die richtige Richtung (danke @robertspierre ) . Ich bin mir nicht sicher, wie Sie die Datei unter Windows extrahieren; Linux kann das, und einige Windows-Tools können es wahrscheinlich auch. Ich habe https://drill.apache.org/download/ verwendet und „Drill für Hadoop 3 und Nicht-Hadoop-Umgebungen, direkter Download“ ausgewählt. Außerdem habe ich microsoft-jdk-21.0.6-windows-x64.msi von https://learn.microsoft.com/en-us/java/openjdk/download heruntergeladen.
Ich habe das erweiterte Verzeichnis apache-drill-1.21.2 (aus dem tar.gz) auf dem Desktop gelassen und es wie folgt gestartet:

Wechseln Sie zu Apache-Drill-1.21.2 und führen Sie dann bin/drill-embedded.bat aus. Anschließend habe ich eine Abfrage mit einer bereitgestellten Parquet-Datei durchgeführt. Das müssen Sie nicht tun, denn … Starten Sie JMP und führen Sie dieses Skript aus:
fields = Associative Array();
fields["queryType"] = "SQL";
fields["query"] = "SELECT * FROM `dfs`.`C:\Users\c\Desktop\apache-drill-1.21.2\sample-data\nation.parquet`";
s = New HTTP Request( URL( "localhost:8047/query.json" ), Method( "POST" ), JSON( Fields( fields ) ), Headers( {"Accept: application/json"} ) ) <<SEND></SEND>
<P>und erhalten Sie diese Tabelle:</P>
<BR />
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><span class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_1-1744504821964.png" style="width: 999px;"><img src="https://us.v-cdn.net/6038925/uploads/images/74790iDA8A4CC22DE4CBA3/Craige_Hales_1-1744504821964.png" role="button" title="Craige_Hales_1-1744504821964.png" alt="Craige_Hales_1-1744504821964.png" /></span></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<BR />
<P>Wenn Sie den oben beschriebenen Drill-Prozess starten, wird ein Webserver gestartet, der die REST-API-Anforderung von JSL verarbeitet. Er verfügt außerdem über eine Webschnittstelle, die meiner Meinung nach zum Lesen von Parquet-Dateien nicht interessant sein dürfte.</P>
<P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Craige_Hales_2-1744505945837.png" style="width: 999px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><SPAN class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><span class="lia-inline-image-display-wrapper" image-alt="Craige_Hales_2-1744505945837.png" style="width: 989px;"><img src="https://us.v-cdn.net/6038925/uploads/images/74791i98CF0F2C6E15C248/Craige_Hales_2-1744505945837.png" role="button" title="Craige_Hales_2-1744505945837.png" alt="Craige_Hales_2-1744505945837.png" /></span></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></P>
<P><A href="https://drill.apache.org/docs/rest-api-introduction/#query" target="_blank" rel="nofollow noopener noreferrer">https://drill.apache.org/docs/rest-api-introduction/#query könnte bei der API helfen.</A></P>
<BR />
<P>interessante Lektüre, bevor Sie zu viel darauf aufbauen:</P>
<P><A href="https://www.starburst.io/blog/the-death-of-apache-drill/" target="_blank" rel="noopener nofollow noreferrer">https://www.starburst.io/blog/the-death-of-apache-drill/</A></P>
<P><A href="https://stackoverflow.com/questions/59754457/mapr-driver-discontinued-for-apache-drill-what-now" target="_blank" rel="noopener nofollow noreferrer">https://stackoverflow.com/questions/59754457/mapr-driver-discontinued-for-apache-drill-what-now</A></P>
<P>und dennoch herrscht weiterhin Betrieb:</P>
<P><A href="https://github.com/apache/drill" target="_blank" rel="noopener nofollow noreferrer">https://github.com/apache/drill</A></P>
<BR />Betreff: Große Parquet-Dateien in JMP importierenDanke schön!
Betreff: Große Parquet-Dateien in JMP importierenDanke schön!
Betreff: Große Parquet-Dateien in JMP importierenWo kann ich die JMP EA-Version testen? Meine Parquets haben zu viele Spalten, um jede einzelne explizit zu definieren. Daher ist die Verwendung von from_dataframe() sehr verlockend.
Betreff: Große Parquet-Dateien in JMP importierenIch bin so langsam mit der Grok3-Methode

Betreff: Große Parquet-Dateien in JMP importierenKontaktieren Sie den JMP-Vertrieb. Es gibt ein Early-Adopter-Programm. Ich denke jedoch, dass Sie, wenn Sie über das MyJMP-Portal Zugriff auf JMP 18 haben, auch Zugriff auf die Early-Adopter-Versionen haben sollten. Möglicherweise gibt es jedoch eine zusätzliche Geheimhaltungsvereinbarung/einen zusätzlichen Schritt.